Dan C.
Dan C.

Reputation: 559

VSTO Outlook addin need to save settings, best way?

I'm writing a VSTO Outlook add in and i need to save some settings the addin gets from a web service. What is the best way to do this. Registry? does the VSTO addin have full access to do something like that? Maybe a file containing the settings?

Thanks in advance.

Upvotes: 25

Views: 21373

Answers (2)

Keith
Keith

Reputation: 21244

You can use a Settings (.settings) file.

The advantage of this file, besides having a centralized and strongly-typed repository, is that you can make these settings either application-scoped or user-scoped. Application settings will be available to all users of the computer. User settings will be individualized for each user. (I believe the framework will actually store these settings in separate files somewhere in the OS. I'm not sure, but it doesn't matter. The beauty of the Settings file is that it takes care of the actual storage and retrieval for you.)

Upvotes: 31

Gary McGill
Gary McGill

Reputation: 27526

You can use a Settings file as per @Keith's answer.

There's some discussion in the comments of that answer saying that the settings will be lost if the Office version is upgraded, because the path to the settings file includes the Office version number.

While that's true, there's an easy solution - simply use settings.Upgrade.

Upvotes: 7

Related Questions