我们的网络应用程序允许存储指向 OneDrive/SharePoint 驱动器文档的链接.
Our web app allows storing links to OneDrive/SharePoint drive documents.
这些链接是通过 OneDrive File Picker UI 获取的,webUrl
字段,如下所示:
These links are obtained with OneDrive File Picker UI, webUrl
field, look like this eg:
https://company.sharepoint.com/sites/devops2/Shared%20Documents/Company%20Cases/A12345%20-%20case%20name%20-%20RENAMED/case-report.pdf
或
https://company-my.sharepoint.com/personal/user_company_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7BC52518FD-05B8-428C-BAE7-A3469890493D%7D&file=%D0%9A%D0%BD%D0%B8%D0%B3%D0%B0.xlsx&action=default&mobileredirect=true
是否有可能以某种方式将此链接转换为驱动器 ID 和项目 ID (driveItem),以便使用 MS Graph API 进行进一步处理?(网络应用程序已经拥有所有令牌/同意)
Is it possible to somehow turn this link into drive-id and item-id (driveItem) for further processing with MS Graph API? (web app has all the tokens/consents already)
答案如下:
https://docs.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=javascript
编码共享 URL"部分(从 OneDrive 文件传递 webUrl
选择器)
使用此编码字符串的 GET 请求/shares/{encodedUrl}/driveItem
GET request with this encoded string to
/shares/{encodedUrl}/driveItem