2014-08-27 260 views
1

當我使用urlOffice 365的API獲取用戶信息

https://outlook.office365.com/EWS/OData/Users 

我可以得到所有用戶的公司,但我怎麼能得到有關特定用戶的詳細信息?

如在Contacts

https://outlook.office365.com/EWS/OData/Me/Contacts 

有一個在UsersEmailAliasDisplayName)給出的信息非常少。如果我需要獲取用戶的電話或公司名稱等,該怎麼辦?還有其他方法嗎?

回答

1

在這裏看到:http://msdn.microsoft.com/en-us/library/office/dn792115%28v=office.15%29.aspx#sectionSection2

您還可以檢索有關使用 聯繫人實體的Id屬性特定聯繫人的信息。

GET https://outlook.office365.com/ews/odata/Me/Contacts(contactId)

樣品JSON響應:基本上你在找什麼!

{ 
    "@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" 
} 
3

這些實際上是兩個不同的東西。用戶節點不是「GET」 -able,你有一個SMTP地址的形式提供用戶ID,如:

GET https://outlook.office365.com/ews/odata/Users("[email protected]") 

的聯繫人API是用來訪問個人只接觸(觸片用戶已將其聯繫人文件夾存儲在其郵箱中)。

這聽起來像你想看到組織中的用戶,在這種情況下,你想使用Azure AD Graph API。 Office 365的用戶信息存儲在Azure AD中。

+0

可以使用相同的訪問令牌檢索Azure AD圖形API嗎? – tatigo 2015-10-13 16:22:50

相關問題