Is it possible to create contact folders with Outlook REST API? I've looked into the docs for Outlook Contacts API and found only references to fetching existing contact folders (even in the beta version).
Other questions seem to focus on using C# and probably some specific SDK for that. I'm using Python, so that wouldn't work for me. I haven't found, both on StackOverflow and through Google in general, any definitive answers to this question. From the lack of any mentions in the docs, I'd assume it's not possible, but just wanted to get a definitive and/or official answer on that matter, if possible. Also please let me know if I missed something during my research. Thanks!
答案 0 :(得分:1)
有一个创建文件夹操作,虽然它似乎specific to Mail folders并且不采用任何可以指定文件夹类型的参数。它可能与父文件夹具有相同的项目类型,但我不确定。
否则,Graph API中有一个特定于Contact文件夹的创建方法;见https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/contactfolder_post_childfolders。
如果您需要特定于Python的SDK,请参阅:https://github.com/microsoftgraph/msgraph-sdk-python。代码示例:https://github.com/search?q=python+sample+user:microsoftgraph&type=Repositories
仅供参考,您可以使用任何代码平台来使用Office 365或Graph API,只要它们支持REST。
答案 1 :(得分:0)
在阅读了@Eric Legault的答案后,它给了我一个盲目尝试的见解。即使文档没有说明,您也可以通过对联系人文件夹端点执行POST来创建文件夹,并在正文中使用DisplayName属性。
那样做
POST https://outlook.office.com/api/<version>/me/contactfolders
{"DisplayName": "folder_name"}
在请求的正文中,它会正常工作,返回通常的201 Created
响应代码。
这在v2.0和beta端点都适用于我。
撰写本文时,Outlook Contacts&#39; UI(自称为Outlook People)非常糟糕,根本不是用户友好的(或者我只是在理解它),所以我实际上不知道如何通过它创建或删除联系人文件夹,但我和#39;很高兴REST API完成这项工作:)