Azure AD graph API to filter users with onPremisesExtensionAttributes [extensionAttribute6] - filter

I need to filter users with the onPremisesExtensionAttributes [extensionAttribute6] is there a graph API call for it?

As #Tinywa suggested in the comment:
onPremisesExtensionAttributes contains extensionAttributes 1-15 for
the user. Note that the individual extension attributes are neither
selectable nor filterable.
You can get all the results first and use your own code logic to filter them.
Or you can consider using extensionProperty as a workaround. Create the extensionProperty and assign value for the users, and then query users with filtering with this extensionProperty. For detailed steps to create extensionProperty and assign value for users, you can refer to this answer.

It looks like they've updated the BETA Graph API so that extension attributes (onPremisesExtensionAttributes) are now filterable.
Try the below in Graph Explorer. You'll need to change the extensionAttribute1 eq 'Employee' part to a query that will actually work in your active directory environment.
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'Employee'&$orderBy=displayName&$select=displayName,mail,onPremisesExtensionAttributes
Please note that this is the BETA Graph API so I guess that means Microsoft hasn't finalized it, so it might change or never get fully released.
EDIT: I also just learned that if you're using this filter via the Graph API, you must add the following header or you'll an error:
client.DefaultRequestHeaders.Add("ConsistencyLevel", "eventual");
The Graph Explorer has this header by default, I guess.
Here's where I found this answer: Get Extended Properties on User using Microsoft Graph
Here's the error I was getting:
Property 'extensionAttribute1' does not exist as a declared property or extension property.

Related

How to get an event ID from the HitID returned by a Microsoft Graph search query?

I am trying to patch a calendar event with the Microsoft Graph API (from a Node express app).
I create a new event with client.api('/me/events').post(myEvent) and it works just fine (I see it appear in my calendar). The return value has an ID which is:
AAMkADc0Yjg2ODdmLTlkNDQtNGQ0Yi1iNjBmLTE1MDdmYzI4MGJkOABGAAAAAADt0ZJy6xMCRq23C8icFGeqBwAOM3XMH4d2SYMQ5psbvFytAAAAAAENAAAOM3XMH4d2SYMQ5psbvFytAAJ_B-B7AAA=
I then use client.api('/search/query').post(myQuery) to find the event based on some criteria, and this works fine. I receive an array of hits, with only one hit (which actually is the freshly created event, looking at the subject and body), and with a hitId equal to:
AAMkADc0Yjg2ODdmLTlkNDQtNGQ0Yi1iNjBmLTE1MDdmYzI4MGJkOABGAAAAAADt0ZJy6xMCRq23C8icFGeqBwAOM3XMH4d2SYMQ5psbvFytAAAAAAENAAAOM3XMH4d2SYMQ5psbvFytAAJ+B/B7AAA=
For some reason I don't understand why the 2 IDs are not fully identical: the _ is changed to +and -changed to /.
I now want to modify the event, and try to update it with
let newVal = hits[0].resource // hits is coming from the result returned by the search query
newVal.id = hits[0].hitId // needed because the 'resource' does not contain the id
client.api('/me/events/'+hitId).patch(newVal)
But I get an error: Resource not found for the segment 'B7AAA='.
Could you please tell me how to make the patch work (and explain why the ID from the search is not strictly like the one created). I have read several examples in the documentation (such as https://learn.microsoft.com/en-us/graph/search-concept-events) but I could not find a solution.
Many thanks!
So what is happening here is, PATCH /me/events/{hitId} is being resolved by Graph API such that the forward slash in the hitId denotes a path and Graph ends up using B7AAA= as a resource id hence the error Resource not found for the segment 'B7AAA='.
A work around that might work is to replace / in hitId(s) with %252F. You can do it like this.
client.api(`/me/events/${hitId.replace('/', '%252F')}`).patch(patch)
There is already this Issue on GitHub for documentation on how to handled these base64 encoded resource ids with /
As for the two IDs being non identical, Graph API will accept both of them and resolve to the same resource. I have no idea why they are different though.

Implement AEM search using query builder API using wildcard-contains in node name

I have a requirement to fetch search results based on partial/wild card in node name to retrieve AEM forms portal data.
For example, if there are multiple draft Id node under any user-email (Unique node created under /conten/forms/fp). each draft application node will reside under conten/forms/fp/.com|.net/metadata/draftId
Note: User nodes will have .com or .net in the end. Image also attached for reference. I should get testsonar#mailiantor.com/testsonar%40#mailinator.com as result since the user has more than one draft application.
My requirement is to find out users who are having multiple drafts. Can anyone suggest this would be possible using Query builder API . I have tried below predicate but noticed that wild card is not supporting in path.
type=nt:unstructured
path=/content/forms/fp/*/drafts/metadata
path.exact=false
path.false=false
When using predicates you should be able to use something like this:
group.1_property.value=%term%
group.1_property=jcr:path
group.1_property.operation=like

Cannot update ticketnumber field on incident

Does anyone know of any way to update the ‘ticketnumber’ field on an ‘incident’ entity after the incident has already been created?
The field is locked down on the front end and have tried via the API using C# code however this fails to write also?
It might not be what you need to do, but you can write a pre-operation plugin working on the create message of the incident to override the ticket number that has been assigned set as the default.
We do this to enable custom ticket numbers to be used, but have never had the need to update them after this point

Get a list of Active Directory Users along with their Full Name and Email

I need to retrieve a list of Active Directory users and their attributes using Delphi 2010.
I've seen a few similar questions on SO (e.g. Delphi - Find primary email address for an Active Directory user), but they all seem to require the user name before any additional information can be retrieved.
I had written an article for [The Delphi Magazine] way back when..... if you have access to a backlog of those magazines, it's in issue no. 62 (October 2000) - unfortunately, it seems those back issues aren't available for purchase anymore :-(
It's too long of an article and a code sample to post here.... basically it's about wrapping the IDirectorySearch interface in a nicer Delphi-like shell. You pass in a base container where to search, you define an LDAP filter, and you define a set of attributes you're interested in - then you search and get back basically an enumerator for the results, which you can get one by one.
In the end, I discovered TJvObjectPickerDialog, part of JVCL. It wraps the Windows Select Object dialog and does everything I need with very little coding. Just set the required properties and call execute. The selected user objects are returned along with the attributes that you set in the 'Attributes' property.

Has anyone used the ConstraintRelationship class for Dynamics CRM?

As documented here there is a property on the AppointmentRequest class for the CRM webservice that allows you to add constraints to what possible appointments are returned from a search.
The actual constraint is specified as an xml string, but I can find almost no documentation about it. Can any one point me to any relevant resources?
I was never able to find any quality documentation on this property or an accepted schema. About all that is available (that I've found) exists on this example from the SDK: Schedule A Resource
You can kind of see how you would limit the search results to a set of resources/users. The list of which properties can be replaced for "name" in the example is in the article ConstraintRelation.Constraints Property.
Hope this helps...

Resources