How can I set my OneDrive as a Trusted Location

Mike Williams 236 Reputation points
2021-07-14T10:07:23.843+00:00

I am creating a VSTO Template for Microsoft Word using Visual Studio 2019.

I have created a GitHub repository https://github.com/MikeWilliams-UK/Word-VSTO-Template to share generic code.
I have documented my journey in getting this working in the projects Wiki https://github.com/MikeWilliams-UK/Word-VSTO-Template/wiki

I am stuck when I save a document to my OneDrive, then try to open it.
I get the error message seen at https://github.com/MikeWilliams-UK/Word-VSTO-Template/wiki/Documents-saved-to-OneDrive even though I have added my OneDrive's folder into Word's list of trusted locations.

Can sonone please help?

Microsoft 365 and Office | Development | Other
Developer technologies | C#
{count} vote

Accepted answer
  1. Mike Williams 236 Reputation points
    2021-07-14T15:03:57.377+00:00
    3 people found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. BrianL 21 Reputation points
    2022-09-13T17:37:00.537+00:00

    Thanks @Mike Williams . I know it's been a year since you posted this, but this put me on the right path to fixing my issue...

    And for those using a personal OneDrive account, you can do the same thing by using "https://d.docs.live.net/nnnnnnnn/" as the folder to put in the trusted location, where "nnnn..." is the identifier for your account. If you just use "https://d.docs.live.net/", it will also work but you will be automatically trusting all files on anybody else's OneDrive folder that they shared with you (not ideal).

    I haven't found an easy way to figure out the identifier... Microsoft goes through great length to hide the fact they are actually opening a web location, and not a local file. The way I found the actual address was to open a file from the OneDrive folder in Excel, go to the developer tab and run visual basic (do a google search to enable the developer tab if you don't see it). In the "Immediate" window in VB, type "? ActiveWorkbook.FullName". That will show you the full filename which points to the OneDrive path, including your identifier...

    It's beyond my as to why MS didn't include this detail in their document that explain how to enable macros. They even have a section dealing with files from a Onedrive location, and all they put was "add trusted folder location" ???

    4 people found this answer helpful.

  2. Mike Williams 236 Reputation points
    2022-09-13T20:43:58.057+00:00

    Glad that my efforts have helped at least one person.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.