Command line for OneDrive for Business sync

​Prompted by a question on the Experts Exchange forums, I decided to investigate how you can pass a Document library address as a parameter to the OneDrive client. The answer was of course revealed by using the wonderful tools Mark Russinovich created: the Sysinternals Suite. More specifically, the Process Explorer tool. All you need to do is to simply configure the displaying of the Command line column. Once you have done this, login to O365, navigate to your personal site (or any other library you would like to sync), exit OneDrive, click the Sync link and go back to Process Explorer to copy the command line. You can also check the command line using Task Manager, however copying the value is not possible there.

And in this case the copy functionality is a mus. The command line will look something like this:

(personal library)
"C:\PROGRA~1\MICROS~1\Office15 GROOVE.EXE" /TakeOffline: "grvopen://https_58_47_47michevdirsync_45my_46sharepoint_46com_47personal_47vasil_95michevdirsync_95onmicrosoft_95com/_aahlEADE3E70_45D2CA_454800_45A73C_45AD18D5D42254_aahn/700?OPENLIST"

(site library)
"C:\PROGRA~1\MICROS~1\Office15\GROOVE.EXE" /TakeOffline: "grvopen://https_58_47_47michevdirsync_46sharepoint_46com/_aahl8287D4C3_45AEB1_454C6E_45AEA3_4584FB472CC7A2_aahn/101?OPENLIST"

(specific folder inside a library)
"C:\PROGRA~1\MICROS~2\Office15\GROOVE.EXE" /TakeOffline: "grvopen://https_58_47_47michevdirsync_46sharepoint_46com/_aahl3FDBD1C5_45FC3B_454B77_459DC9_45625D61B859B6_aahn/101/_47HuKuTy?OPENFOLDER"

Let’s dissect this looong line. The first part is of course the short path to your OneDrive for business client, aka Groove.exe. The /TakeOffline parameter is what signals the Syncing attempt, and it’s followed by the Site collection URL. The _## thingies you see in the address are the ASCII codes for the symbols “:”, “/”, “-“, “.”, “_” and so on. After that follows GUID, which should correspond to the library GUID, such as “{8287D4C3-AEB1-4C6E-AEA3-84FB472CC7A2}”. An easy way to get the GUID is to open the Library settings and copy the URL from the browser, the last part will give you the GUID.

The string at the end controls the message, UI elements and also the Location:

100 will give the “Ready to sync your OneDrive for Business documents?” message. This is the default message for syncing Personal files. It this case however, it will default to your Office account, your personal OneDrive library! The same will happen if you omit the part after the last “/”. It will simply ignore the library path you have given.

101 seems to be the default for Document Libraries. The UI will give you the name of the library and the name of the site/tenant you are going to sync.

Other numbers have different effects, some will always default to the Personal OneDrive for the account you used to activate Office. Someone with programming experience might be able to figure them out 🙂

The last part, after the question mark, signals the action to be performed: OPENLIST for a library, OPENFOLDER for a folder within a library, with the path prepended.

UPDATE 07/11/2014: Thanks to Wicus van den Berg, the numbers are now clear – they correspond to the SharePoint list template type. So 101 is a document library, 700 is MySiteDocumentLibrary. More info here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx

In addition, updated the syntax to show Folder sync.

This entry was posted in Office 365, OneDrive for Business. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *