Get OneDrive item id for current Word document in bulk drive

I am working on an addition Office.js Word, but the document is stored on a group drive. How can I get all or group id, drive idand item idfor the current document

Related question here

But the solution didn’t work for me, as for a personal disk

Current solution

I have a solution, but I'm not sure if this is sound

The url I got in getFilePropertiesAsync is in the following format

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

  • siteUrl: its site url https://abc.sharepoint.com
  • groupnamelikestring: Not exactly the name of the group, but something like that when some special characters are deleted and everything is lowercase.
  • pathtodoc: This is the path to the document on disk and the common point.

1. Get a group object

URL,

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

, mailNickName

  • , groupnamelikestring === mailNickName?

  • , ?

  • , mailNickName PATCH call

groupnamelikestring === mailNickName ?

2. drive id item id

, . URL, drive id, item id.

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

  • groupid: , .
  • pathtodoc: we git URL- .
+4

Source: https://habr.com/ru/post/1685858/


All Articles