I am successfully using ResolveName to get most of the contact information I need. Below is the code I am using:
PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties); NameResolutionCollection match = await mailClient.Service.ResolveName(customerEmail, ResolveNameSearchLocation.DirectoryOnly, true, itempropertyset);
I am querying against my Office365/Azure AD tenant. One of the values I need is not being returned though.
I would like to get the user/contact's Object ID as shown in the Azure Portal - Azure Active Directory - Users - Basic Info screen.
Is that possible using EWS Managed API?
Regards.
You cannot get Azure AD user's
object IDusing EWS Managed API. Alternatively, you can make use of Microsoft Graph API.I tried to reproduce the same in my environment via Graph Explorer and got below results:
I have Azure AD user named
Sriin my tenant with below properties:To get the Azure AD user's details via Graph API, I ran below query:
Response:
To get only
object IDof an Azure AD user, you can include $select in the query like below:Response:
Before running the above queries, make sure to grant consent to required permissions like below:
Go to Graph Explorer -> Modify permissions -> Click on Consent
You will get consent screen and click on
Acceptlike below:After granting the consent, you can run the queries successfully.