Forum Discussion

Stefan Szynaka's avatar
Stefan Szynaka
Copper Contributor
Aug 15, 2018

REST get OneDrive sync link

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...
  • Stefan Szynaka's avatar
    Stefan Szynaka
    Aug 16, 2018

    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

Resources