SOLVED

REST get OneDrive sync link

%3CLINGO-SUB%20id%3D%22lingo-sub-228797%22%20slang%3D%22en-US%22%3EREST%20get%20OneDrive%20sync%20link%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228797%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20way%20to%20get%20or%20construct%20a%20Sharepoint%20folder%20sync%20link%20(for%20OneDrive%20for%20Business)%20using%20the%20REST%20API%3F%3CBR%20%2F%3EI%20have%20the%20requirement%20to%20implement%20a%20sync%20button%20to%20a%20application%20in%20order%20to%20remove%20the%20need%20for%20users%20to%20visit%20the%20Sharepoint%20Online%20site%20folder%20to%20enable%20OneDrive%20sync.%3CBR%20%2F%3EI%20looked%20all%20over%20but%20couldn't%20find%20any%20information%20on%20how%20the%20sync%20request%20works%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-228797%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-229163%22%20slang%3D%22en-US%22%3ERe%3A%20REST%20get%20OneDrive%20sync%20link%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-229163%22%20slang%3D%22en-US%22%3E%3CP%3Eafter%20hours%20of%20hunting%20and%20following%20breadcrumbs%20I%20got%20it%20working.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20follwing%20URL%20has%20to%20be%20called%20in%20the%20browser%20to%20launch%20the%20OneDrive%20sync%20dialog%3A%3C%2FP%3E%3CPRE%3Eodopen%3A%2F%2Fsync%3F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bscope%3DOPENFOLDER%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20static%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BsiteId%3D4d19e34e-9b05-xxxx-bb52-0cad8778ea21%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20Site%20GUID%20-_vti_bin%2Fclient.svc%2FProcessQuery%20or%20https%3A%2F%2Fxxxxxxxxxxxx.sharepoint.com%2Fsites%2Fweb%2F_api%2Fweb%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BwebId%3D44b26a7c-8d22-xxxx-a337-5185e2e55d8f%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20Web%20GUID%20-%20_vti_bin%2Fclient.svc%2FProcessQuery%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BwebTitle%3DOneDrive%20Sync%20button%20test%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20Teamsite%20title%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BlistId%3D%257B5274FD7E-97AC-xxxx-8645-FC5410F89E27%257D%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20_vti_bin%2Fclient.svc%2FProcessQuery%20or%20Value%20can%20be%20found%20in%20the%20Sharepoint%20folder%20webpage%20url%20-%20%26amp%3BList%20key%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BlistTitle%3DPrototype%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20Document%20library%20title%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BuserEmail%3Dstefan%2540xxxx%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20user%20email%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BlistTemplateTypeId%3D101%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20%2F_api%2FWeb%2FLists%2FgetByTitle('%3CLIST%20name%3D%22%22%3E')%2FBaseTemplate%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BwebUrl%3Dhttps%253A%252F%252xxxxxxxx.sharepoint.com%252Fsites%252Fweb%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20full%20site%20url%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BwebLogoUrl%3D%252Fsites%252Fweb%252FSiteAssets%252Fspo-shared-data.png%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%20website%20logo%20-%20can%20be%20empty%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BwebTemplate%3D68%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%3D%20static%20value%2Fconfig%20-%20%2F_api%2Fweb%2FGetAvailableWebTemplates(1033)%2Fgetbyname('SITEPAGEPUBLISHING%230')%22%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BisSiteAdmin%3D1%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%201%20%3A%20yes%20%2F%200%3A%20no%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BfolderId%3Dcbab51b9-fa01-xxxx-b324-ad52ff28deaf%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%20folder%20Unique%20ID%20-%20%2F_api%2Fweb%2FGetFolderByServerRelativeUrl('%7Brelative%20folder%20path%7D')%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BfolderName%3DTestFolder%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%3D%20folder%20name%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26amp%3BfolderUrl%3D%252Fsites%252Fweb%252FPrototype%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%3D%20relative%20folder%20path%20-%20%3C%2FLIST%3E%3C%2FPRE%3E%3CP%3ETo%20get%20the%20values%20for%20the%20site%2C%20web%20%26amp%3B%20folder%20ID%2C%20you%20have%20to%20issue%20a%20call%20to%20the%3C%2FP%3E%3CPRE%3E_vti_bin%2Fclient.svc%2FProcessQuery%3C%2FPRE%3E%3CP%3Eendpoint.%20I've%20attached%20a%20file%20with%20the%20XML%20payload%20for%20this%20call%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-228943%22%20slang%3D%22en-US%22%3ERe%3A%20REST%20get%20OneDrive%20sync%20link%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228943%22%20slang%3D%22en-US%22%3E%3CP%3EUnforturnatly%2C%20no.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESome%20additional%20background%3A%3C%2FP%3E%3CP%3EWe%20are%20working%20with%20client%20related%20documents%20and%20the%20document%20library%20has%20a%20document%20set%20for%20each%20of%20the%20clients%3C%2FP%3E%3CP%3EThe%20requirement%20is%20for%20a%20CRM%20system%20at%20a%20non-profit%20organization%2C%20the%20issue%20is%20that%20they%20have%20a%20network%20of%20volunteers%20who%20are%20mostly%20not%20very%20computer%20literate.%20Therefore%2C%20I%20want%20to%20add%20a%20OneDrive%20sync%20button%20to%20avoid%20the%20need%20for%20them%20to%20interact%20with%20the%20SharePoint%20UI.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-228804%22%20slang%3D%22en-US%22%3ERe%3A%20REST%20get%20OneDrive%20sync%20link%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228804%22%20slang%3D%22en-US%22%3ECould%20Known%20Folder%20Move%20be%20an%20option%20for%20this%20scenario%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fonedrive%2Fredirect-known-folders%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fonedrive%2Fredirect-known-folders%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Is there a way to get or construct a Sharepoint folder sync link (for OneDrive for Business) using the REST API?
I have the requirement to implement a sync button to a application in order to remove the need for users to visit the Sharepoint Online site folder to enable OneDrive sync.
I looked all over but couldn't find any information on how the sync request works

3 Replies
Highlighted
Could Known Folder Move be an option for this scenario?

https://docs.microsoft.com/en-us/onedrive/redirect-known-folders
Highlighted

Unforturnatly, no.

 

Some additional background:

We are working with client related documents and the document library has a document set for each of the clients

The requirement is for a CRM system at a non-profit organization, the issue is that they have a network of volunteers who are mostly not very computer literate. Therefore, I want to add a OneDrive sync button to avoid the need for them to interact with the SharePoint UI.

Highlighted
Best Response confirmed by Stefan Szynaka (New Contributor)
Solution

after hours of hunting and following breadcrumbs I got it working.

 

the follwing URL has to be called in the browser to launch the OneDrive sync dialog:

odopen://sync?
    scope=OPENFOLDER                                                    = static
    &siteId=4d19e34e-9b05-xxxx-bb52-0cad8778ea21                        = static value/config - Site GUID -_vti_bin/client.svc/ProcessQuery or https://xxxxxxxxxxxx.sharepoint.com/sites/web/_api/web
    &webId=44b26a7c-8d22-xxxx-a337-5185e2e55d8f                         = static value/config - Web GUID - _vti_bin/client.svc/ProcessQuery
    &webTitle=OneDrive Sync button test                                 = static value/config - Teamsite title
    &listId=%7B5274FD7E-97AC-xxxx-8645-FC5410F89E27%7D                  = static value/config - _vti_bin/client.svc/ProcessQuery or Value can be found in the Sharepoint folder webpage url - &List key
    &listTitle=Prototype                                                = Document library title
    &userEmail=stefan%40xxxx                                            = user email
    &listTemplateTypeId=101                                             = static value/config - /_api/Web/Lists/getByTitle('<list name>')/BaseTemplate
    &webUrl=https%3A%2F%2xxxxxxxx.sharepoint.com%2Fsites%2Fweb          = full site url
    &webLogoUrl=%2Fsites%2Fweb%2FSiteAssets%2Fspo-shared-data.png       = website logo - can be empty
    &webTemplate=68                                                     = static value/config - /_api/web/GetAvailableWebTemplates(1033)/getbyname('SITEPAGEPUBLISHING#0')";                                                        
    &isSiteAdmin=1                                                      = 1 : yes / 0: no                                            
    &folderId=cbab51b9-fa01-xxxx-b324-ad52ff28deaf                      = folder Unique ID - /_api/web/GetFolderByServerRelativeUrl('{relative folder path}')"
    &folderName=TestFolder                                              = folder name
    &folderUrl=%2Fsites%2Fweb%2FPrototype                               = relative folder path -

To get the values for the site, web & folder ID, you have to issue a call to the

_vti_bin/client.svc/ProcessQuery

endpoint. I've attached a file with the XML payload for this call