Kevin Pham
Kevin Pham

Reputation: 27

OData - get individual property of an entity

I was using

https://graph.windows.net/aaa2a672-ae0e-4ac3-9aec-xxxxxx/groups?api-version=1.6&$filter=displayName%20eq%20'kevingroup2'

to get data of kevingroup2

The response was

{ "odata.metadata": "https://graph.windows.net/aaa2a672-ae0e-4ac3-9aec-xxxx/$metadata#directoryObjects", "value": [ { "odata.type": "Microsoft.DirectoryServices.Group", "objectType": "Group", "objectId": "b5685a42-1de7-478d-94b4-de50ac9a2222", "deletionTimestamp": null, "description": "kevin group 2", "dirSyncEnabled": null, "displayName": "kevingroup2", "lastDirSyncTime": null, "mail": null, "mailNickname": "d6460146-0", "mailEnabled": false, "onPremisesDomainName": null, "onPremisesNetBiosName": null, "onPremisesSamAccountName": null, "onPremisesSecurityIdentifier": null, "provisioningErrors": [], "proxyAddresses": [], "securityEnabled": true } ] }

How do I extract objectId of the record?

Thanks!

Upvotes: 0

Views: 237

Answers (1)

Hury Shen
Hury Shen

Reputation: 15754

You just need to use the api with the filter as below:

https://graph.windows.net/xxxxxxxxx/groups?$filter=displayName eq 'kevingroup2'&$select=objectId

By the way, Microsoft recommends customers to use microsoft graph rather than azure ad graph. So you can refer to this microsoft graph api to get the groups.

Upvotes: 0

Related Questions