SharePoint file paths in Office add-ins

Copper Contributor

Hi,

We have an Excel VSTO (desktop) add-in which needs to access the file path of the open Workbook. (The FullName property of the Excel application object provides this.) If the file is in SharePoint and synchronised to a local folder using OneDrive with the 'use Office applications to sync Office files that I open' setting enabled, I would expect the file path to be the SharePoint URL even if the user opens the Excel file from the local folder using File Explorer. Normally this works but a few users have reported that the file path shown is always to the local folder. I checked one computer and made sure that SharePoint was added as a connected service, the latest version of OneDrive was installed, OneDrive was synching the folder and the aforementioned setting was enabled. The user can open the file through Excel by going to File then Open and navigating to the SharePoint folder and again afterwards by clicking the item in the recent files list. In both these scenarios, the file path (FullName property) is the SharePoint URL as expected. It's just File Explorer that's not behaving correctly. Are there any other settings in Office, SharePoint or OneDrive that might override the expected behaviour when opening a file from File Explorer?

Any suggestions welcome!

Thanks,

Pete

0 Replies