Reputation: 11
When I use the url
https://outlook.office365.com/EWS/OData/Users
I can get all users in a company, but how can I get more details about a specific user?
Such as in Contacts
:
https://outlook.office365.com/EWS/OData/Me/Contacts
There is very little information given in Users
(Email
, Alias
, DisplayName
). What if I need to get a user's phone or company name and so on? Are there any other ways?
Upvotes: 1
Views: 7711
Reputation: 14619
See here: http://msdn.microsoft.com/en-us/library/office/dn792115%28v=office.15%29.aspx#sectionSection2
You can also retrieve information about a specific contact by using the Id property of the Contact entity.
GET https://outlook.office365.com/ews/odata/Me/Contacts(contactId)
Sample JSON Response: basically what you are looking for!
{
"@odata.id": "https://outlook.office365.com/EWS/OData/Users('[email protected]')/Contacts('AAMkADA5...')",
"@odata.etag": "W/\"EQAAABYAAACjVbBbHnDNQZzaeCbB94zAAABkh+ph\"",
"@odata.editLink": "https://outlook.office365.com/EWS/OData/Users('[email protected]')/Contacts('AAMkADA5...')",
"Id": "AAMkADA5...",
"ChangeKey": "EQAAABYAAACjVbBbHnDNQZzaeCbB94zAAABkh+ph",
"ClassName": "IPM.Contact",
"Subject": "Alex Darrow",
"BodyPreview": "",
"Body": {
"ContentType": "Text",
"Content": ""
},
"Importance": "Normal",
"Categories": [],
"HasAttachments": false,
"ParentFolderId": "AAMkADA5...",
"Birthday": null,
"FileAs": "Darrow, Alex",
"DisplayName": "Alex Darrow",
"GivenName": "Alex",
"Initials": null,
"MiddleName": null,
"NickName": null,
"Surname": "Darrow",
"Title": null,
"Generation": null,
"EmailAddress1": "[email protected]",
"ImAddress1": null,
"ImAddress2": null,
"ImAddress3": null,
"JobTitle": null,
"CompanyName": null,
"Department": null,
"OfficeLocation": null,
"Profession": null,
"BusinessHomePage": null,
"AssistantName": null,
"Manager": null,
"HomePhone1": null,
"HomePhone2": null,
"BusinessPhone1": null,
"BusinessPhone2": null,
"MobilePhone1": null,
"OtherPhone": null,
"DateTimeCreated": "2014-07-01T16:24:09Z",
"LastModifiedTime": "2014-07-01T16:24:09Z",
"[email protected]": "https://outlook.office365.com/EWS/OData/Users('[email protected]')/Contacts('AAMkADA5...')/Attachments"
}
Upvotes: 1
Reputation: 17702
These are actually two different things. The Users node isn't "GET"-able, you have to supply a user ID in the form of an SMTP address, like:
GET https://outlook.office365.com/ews/odata/Users("[email protected]")
The Contacts API is used to access personal contacts only (the contacts a user has stored in their Contacts folder in their mailbox).
It sounds like you want to see users in the organization, in which case you want to use the Azure AD Graph API. The user information for Office 365 is stored in Azure AD.
Upvotes: 3