Get sharepoint siteurl using weburl with MS Graph

与世无争的帅哥 提交于 2021-02-08 08:46:34

问题


I have onenote notebooks hosted at sharedpoint. I have a weburl to access that notebook. How I can retrieve siteId and siteCollectionId using webUrl with MS Graph API.

Sample webUrl is -

https://companyall-my.sharepoint.com/personal/ash_desh_company_com/Documents/Notebooks/Notebook1


回答1:


If you encode the webUrl using this process and then make a request to the following you should be able to access the ids:

https://graph.microsoft.com/v1.0/shares/{encodedurl}/site?select=sharepointIds

As an example, for the example URL you provided it would look like:

https://graph.microsoft.com/v1.0/shares/u!aHR0cHM6Ly9jb21wYW55YWxsLW15LnNoYXJlcG9pbnQuY29tL3BlcnNvbmFsL2FzaF9kZXNoX2NvbXBhbnlfY29tL0RvY3VtZW50cy9Ob3RlYm9va3MvTm90ZWJvb2sx/site?select=sharepointIds

Note that the ids are returned using the older nomenclature, so siteId = siteCollectionId and webId = siteId



来源:https://stackoverflow.com/questions/46465967/get-sharepoint-siteurl-using-weburl-with-ms-graph

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