获取联系人
命名空间:microsoft.graph
检索 contact 对象的属性和关系。
在两种方案中,应用可以获取其他用户的联系人文件夹中的联系人:
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | Contacts.Read、Contacts.ReadWrite |
| 委派(个人 Microsoft 帐户) | Contacts.Read、Contacts.ReadWrite |
| 应用程序 | Contacts.Read、Contacts.ReadWrite |
HTTP 请求
用户邮箱中的联系人。
GET /me/contacts/{id}
GET /users/{id | userPrincipalName}/contacts/{id}
来自用户的顶级 contactFolder 中的 联系人。
GET /me/contactfolders/{Id}/contacts/{id}
GET /users/{id | userPrincipalName}/contactfolders/{id}/contacts/{id}
contactFolder 的子文件夹中包含的 联系人。下面的示例显示了一个嵌套级别,但联系人可能位于子级的子级中,诸如此类。
GET /me/contactFolders/{id}/childFolders/{id}/.../contacts/{id}
GET /users/{id | userPrincipalName}/contactFolders/{id}/childFolders/{id}/contacts/{id}
可选的查询参数
| 名称 | 值 | Description |
|---|---|---|
| $expand | string | 要在响应中扩展和包括的关系的列表(以逗号分隔)。请参阅支持的名称的 contact 对象的关系表。 |
| $select | string | 要在响应中包括的属性的列表(以逗号分隔)。 |
请求标头
| 标头 | 值 |
|---|---|
| Authorization | Bearer {token}。必需。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和 contact 对象。
示例
请求
下面是一个请求示例。
GET https://graph.microsoft.com/v1.0/me/contacts/{id}
响应
这是一个示例响应。注意:为提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "AAMkAGI2THk0AAA=",
"createdDateTime": "2014-10-19T23:08:24Z",
"lastModifiedDateTime": "2014-10-19T23:08:24Z",
"changeKey": "EQAAABYAAACd9nJ/tVysQos2hTfspaWRAAADTIa4",
"categories": [],
"parentFolderId": "AAMkAGI2AAEOAAA=",
"birthday": "1974-07-22",
"fileAs": "Fort, Garth",
"displayName": "Garth Fort",
"givenName": "Garth",
"initials": "G.F.",
"middleName": null,
"nickName": "Garth",
"surname": "Fort",
"title": null,
"yomiGivenName": null,
"yomiSurname": null,
"yomiCompanyName": null,
"generation": null,
"emailAddresses": [
{
"name": "Garth",
"address": "garth@a830edad9050849NDA1.onmicrosoft.com"
}
],
"imAddresses": [
"sip:garthf@a830edad9050849nda1.onmicrosoft.com"
],
"jobTitle": "Web Marketing Manager",
"companyName": "Contoso, Inc.",
"department": "Sales & Marketing",
"officeLocation": "20/1101",
"profession": null,
"businessHomePage": "https://www.contoso.com",
"assistantName": null,
"manager": null,
"homePhones": [],
"mobilePhone": null,
"businessPhones": [
"+1 918 555 0101"
],
"homeAddress": {},
"businessAddress": {
"street": "10 Contoso Way",
"city": "Redmond",
"state": "WA",
"countryOrRegion": "USA",
"postalCode": "98075"
},
"otherAddress": {},
"spouseName": null,
"personalNotes": null,
"children": []
}
反馈
提交和查看相关反馈