Microsoft Graph API:获取默认联系人文件夹

问题描述 投票:0回答:1

我正在尝试获取默认联系人文件夹。 目前我正在尝试在 graph api 上测试它们。 如果我

https://graph.microsoft.com/v1.0/me/contacts
,我可以正确获取所有联系人列表。 例如,

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('8fa9xxxx-4eb9-acb4xxxxx5707')/contacts",
"value": [
    {
        "@odata.etag": "W/\"EQAAAB........HYPlAACRIrzX\"",
        "id": "AAMkAGUyM2Exxxxxxxxxxxxxxxxxxxxxxxx.... xxQVwWHYPlAACRUWbVAAA=",
        "createdDateTime": "2024-04-15T01:39:57Z",
        "lastModifiedDateTime": "2024-04-15T01:39:59Z",
        "changeKey": "EQAAA.......YPlAACRIrzX",
        "categories": [],
        "parentFolderId": "AAMkAGUyM2xxxxxxxxxAAAAAEOAAA=",
        "birthday": null,
        "fileAs": "gisu123"..........
.......,

但是,如果我这样做了

https://graph.microsoft.com/v1.0/me/contactFolders
,就没有回报。

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('8fxxxxxxxxxxxx5707')/contactFolders",
    "value": []
}

但是当我将父文件夹 id 与联系人文件夹一起使用时,它可以工作。

https://graph.microsoft.com/v1.0/me/contactfolders/AAMkAGUxxxxxxxxxI3Ny1iMDUyLWI0OTxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXBZC4AAAAAAEOAAA=
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('8fa9a94f-1752-4eb9-acb4-a2eac51a5707')/contactFolders/$entity",
    "id": "AAMkAGUyM2xxxxxxxxxxxxxxxxxxAQDMA-lWCJwxSZ24LJrXBZCxxxxxOAAA=",
    "parentFolderId": "AAMkAGUyM2ExYxxxxxxx3Ny1iMDUyLWI0OTIyNzAyODVhMwAuAAAAxxxxxxxWkPkKe6D2sAQDMA-lWCJwxSZ24LJxxxxxAAAAAEIAAA=",
    "displayName": "Contacts"
}

但是,此方法仅在联系人上存在现有地址时才可用。有没有办法直接获取联系人(默认文件夹)?

microsoft-graph-api office365api
1个回答
0
投票

通过使用众所周知的名称Contacts作为默认文件夹应该可以实现。

GET https://graph.microsoft.com/v1.0/me/contactFolders/contacts
© www.soinside.com 2019 - 2024. All rights reserved.