Get OneDrive Item Id for Current Word doc in a group drive

ぃ、小莉子 提交于 2019-12-10 13:17:32

问题


I'm working on a Office.js Word addin but document is stored on group drive. How can i get either or all of group id , drive id and item id for current document

Related question is here

But solution didn't work for me as it is for personal drive

Current Solution

I have a solution but i'm not sure it is sound

The url I get in getFilePropertiesAsync is in following format

<siteUrl>/sites/<groupnamelikestring>/Shared Documents/<pathtodoc>

  • siteUrl : Its a site url like https://abc.sharepoint.com
  • groupnamelikestring : Not quite group name but something similar where some special characters are removed and everything in lowercase.
  • pathtodoc : This is path to document in drive and share point.

1. Get Group object

By using following URL i can get group object

https://graph.microsoft.com/v1.0/groups?$filter=mailNickName eq '<groupnamelikestring>'

This returns required group but I'm not quite sure about mailNickName property

  1. Is it guaranteed that groupnamelikestring === mailNickName?

  2. what happens when group name gets renamed?

  3. what happens if mailNickName updated using PATCH call

Is groupnamelikestring === mailNickName is sound?

2. Getting Drive Id and Item ID

It is straight forard once we have group object. Using following URL we can get both Drive Id and Item ID.

https://graph.microsoft.com/v1.0/groups/<groupid>/drive/root:/<pathtodoc>

Here

  • groupid : THis is group ID we got in previous step
  • pathtodoc : This is path to document we git from document url.

来源:https://stackoverflow.com/questions/46275014/get-onedrive-item-id-for-current-word-doc-in-a-group-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!