I'm trying to share a link with users that will automatically sync a specified sharepoint library.

I've used this microsoft article to get things going and I've got most of the way there.

I grabbed most of the bits it needs from _spPageContextInfo on the page source of the library in question.

The link works in that it redirects to onedrive and automatically syncs a library, however the library it syncs isnt the one I'm after. Infact, its not one I'm aware of.

Rather than being "MyCompanyName - My Library Name" it syncs a random library called "MyCompanyName Documents" which is almost empty, aside from a couple of 'how to use this library' files.

I've been through the library settings and triple checked the SiteID, ListID and WebID. I'm pretty certain they are correct. I'm not 100% on the WebURL, as there is no entry for that exact term in the _spPageContextInfo, so I've tried using a variety of URL's, but dont seem to be getting any closer.

I found another article which explains how it works and also has links to a aspx file you can add to your library which will generate the link for you, but that didnt work for me - the variables were not populated in the link that was generated in the file - seemed pretty static to me. :(

Can anyone help me out with this?

Many thanks in advance.

1 Answer 1


Using the link format of this:


You can find the webId and siteID by following this link and copying the GUID:


Document Library / List ID can be found in the URL when on the list / library settings page:


WebUrl can be found by using:


I would double check again using those methods, the web url instead of using 'https://' seems to need 'https%3A%2F%2F' instead.

  • Thanks @JMyner - do any of the values need to be encapsulated in braces or not?
    – John
    Sep 27, 2019 at 10:47
  • 1
    @jon remove all the curly braces
    – JMyner
    Sep 27, 2019 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.