How to Manually Create a OneDrive Sync Link from Your SharePoint Page

Image Title

posted by Khoa Quach
on Dec 25, 2018

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.

OneDrive Sync Link
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:

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

odopen://sync/?siteId=SiteID_HERE&webId=WebID_HERE&listId=ListID_HERE&userEmail=UserEmail_HERE&webUrl=WebURL_HERE"

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 “CreateOD.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.

OneDrive Sync Link

3. Click on the uploaded page. You should see the following:

OneDrive Sync Link

4. Select a document library from the dropdown.

5. You can now copy the link provided and use it anywhere on your SharePoint site OR click on “Sync OneDrive” to launch.

Create a OneDrive Sync Link from the SharePoint page, you are done!

***

[Read more: Create and Deploy Your Own Custom SharePoint Theme]

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 office 365 support here!