Search code examples
c#sharepointoffice-interoponedrive

Microsoft Office Document shows Sharepoint URL instead of Local


Situation: OneDrive for Business syncs files from Sharepoint Site Document Library to local directory:

C:\Users\users\Sharepoint\Library\Test.pttx

However with PowerPoint InterOp the:

presentation.Path

Is:

https://company.sharepoint.com/Library/Shared%20Documents/

Which is the correct path for Sharepoint.

How can I access the local directory?

Update: I found a similar question on MSDN but no answer


Solution

  • According to this post, the synced folders can be looked up in this multi-string registry value:

    HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common \Internet\LocalSyncClientDiskLocation

    Given that your local path and SharePoint URL look like

    C:\Users\User\SharePoint\Library - Documents\Folder\SubFolder\Document.pptx and https://***.sharepoint.com/Library/Shared%20Documents/Folder/SubFolder/Document.pptx,

    you could try extracting the local part Folder/SubFolder/Document.pptx from the URL, add it to the local folder paths retrieved from the registry value and check for file existence.