获取共享文件夹中的 Outlook 联系人Get Outlook contacts in a shared folder

使用 Outlook,客户可以与其他人共享文件夹,并授予对各个联系人文件夹的“读取”、“创建”、“修改”或“删除”访问权限。Outlook lets customers share folders with one another and provide "read", "create", "modify", or "delete" access to individual contact folders. 此外,使用 Outlook,客户还可以委托其他用户代表自己执行操作,并访问特定文件夹或客户的整个邮箱;在 Outlook 中,这也称为“委托”。Outlook also allows a customer to delegate another user to act on the customer's behalf, and access specific folders or the customer's entire mailbox; this is also known as "delegation" in Outlook.

Microsoft Graph 以编程方式支持在其他用户共享的联系人文件夹中获取联系人,以及获取共享文件夹本身。Programmatically, Microsoft Graph supports getting contacts in contact folders that have been shared by other users, as well as getting the shared folders themselves. 此支持还适用于已委托的邮箱中的文件夹。The support also applies to folders in a delegated mailbox.

例如,Garth 已与 John 共享自定义联系人文件夹并向 John 授予读取权限。As an example, Garth has shared with John a custom contact folder and given John read access. 如果 John 已登录应用并提供委托的权限(Contacts.Read.Shared 或 Contacts.ReadWrite.Shared),应用便能访问 Garth 的自定义联系人文件夹和该文件夹中的联系人,如下所述。If John has signed into your app and provided delegated permissions (Contacts.Read.Shared or Contacts.ReadWrite.Shared), your app will be able to access Garth's custom contact folder and contacts in that folder as described below.

注意通过共享权限(Contacts.Read.Shared 或 Contacts.ReadWrite.Shared),你可以在共享或委托文件夹中读取或写入联系人。Note The sharing permissions (Contacts.Read.Shared or Contacts.ReadWrite.Shared) allow you to read or write contacts in a shared or delegated folder. 它们不支持订阅此类文件夹中的项的更改通知They do not support subscribing to change notifications on items in such folders. 若要对租户中共享、委托或任何其他用户的联系人文件夹中的联系人设置更改通知订阅,请使用应用程序权限 Contacts.Read。To set up change notification subscriptions on contacts in a shared, delegated, or any other user's contact folder in the tenant, use the application permission, Contacts.Read.

获取共享文件夹中的联系人Get a contact in the shared folder

可在 Garth 已与 John 共享的自定义联系人文件夹中获取特定联系人:You can get a specific contact in the custom contact folder that Garth has shared with John:

GET users/{Garth-userId | Garth-userPrincipalName}/contactFolders/{folder-id}/contacts/{id}

成功完成后,你将收到“HTTP 200 正常”消息和由来自 Garth 共享联系人文件夹的 {id} 标识的联系人实例。On successful completion, you'll get HTTP 200 OK and the contact instance identified by {id} from Garth's shared contact folder.

获取共享文件夹中的所有联系人Get all contacts in the shared folder

获取 Garth 共享联系人文件夹中的所有联系人:Get all the contacts in Garth's shared contact folder:

GET users/{Garth-userId | Garth-userPrincipalName}/contactFolders/{folder-id}/contacts

成功完成后,你将收到“HTTP 200 正常”消息和 Garth 共享联系人文件夹中的联系人实例的集合。On successful completion, you'll get HTTP 200 OK and a collection of contact instances in Garth's shared contact folder.

获取共享文件夹Get the shared folder

获取 Garth 已与 John 共享的联系人文件夹。Get the contact folder that Garth has shared with John.

GET users/{Garth-userId | Garth-userPrincipalName}/contactFolders/{folder-id}

成功完成后,你将收到“HTTP 200 正常”消息和表示 Garth 共享联系人文件夹的 contactFolder 实例。On successful completion, you'll get HTTP 200 OK and a contactFolder instance that represents Garth's shared contact folder.

如果 Garth 已向 John 委托其整个邮箱,则将适用相同的 GET 功能。The same GET capabilities apply if Garth had delegated John his entire mailbox.

如果 Garth 未与 John 共享联系人文件夹,也未将他的邮箱委派给 John,那么在这些 GET 操作中指定 Garth 的用户 ID 或用户主体名称将返回错误。If Garth has not shared the contact folder with John, nor has he delegated his mailbox to John, specifying Garth’s user ID or user principal name in those GET operations will return an error.

后续步骤Next steps

详细了解以下信息:Find out more about: