How to Manually Create a OneDrive Sync Link from SharePoint

By Khoa Q.
Published 8 months ago
~2 minute read
wave small

For those familiar with SharePoint document libraries and OneDrive for Business, there is a button that I think you’ll find quite useful: meet the OneDrive “Sync” button.


Sync will let you sync the current library to your OneDrive. I was recently asked to add the sync functionality to a page for a custom SharePoint application that we built. The idea was to allow the end users to stay on the application page without having to struggle to find the “Sync” button within the nested document libraries.

To do this, we had to refer to the documentation provided by Microsoft:

deploy the new onedrive sync client for windows learn how to deploy the onedrive sync client to your office 365

Basically, you can create a simple anchor HTML link that will open a site following this format:


Developers will see that most of the information needed is in the _spPageContextInfo object that gets generated on every SharePoint page. For those non-devs curious about how they might find the necessary information to go this route, I have created a standalone page available on GitHub and I’ve provided the step-by-step guide below.

OneDrive Sync Link Creation Steps

  1. Go to GitHub (link here) and download the “Create-OD-Links.aspx ”page.
  2. Go to a SharePoint site and upload the page to any document library (e.g. Shared Documents, Pages, etc.). Please note that the code will only retrieve the document libraries of and generate links for assets under the current site. (Make sure that your site allows custom script Microsoft Article)


  1. Fill in the site url, select the library to share, and enter an email. Screenshot_9.png

  2. Select a document library from the dropdown.

  3. Click or Copy the generated link

Here at NIFTIT, from Office 365 consulting to SharePoint solutions, we can handle projects of any size and difficulty. We follow industry standards and best practices to build world-class solutions. learn more about our services here!