Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTO Outlook addin need to save settings, best way?

Tags:

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.

like image 473
Dan C. Avatar asked Nov 30 '11 20:11

Dan C.


People also ask

How do I add Vsto to Outlook?

On the File menu, point to New, and then click Project. In the templates pane, expand Visual C# or Visual Basic, and then expand Office/SharePoint. Under the expanded Office/SharePoint node, select the Office Add-ins node. In the list of project templates, choose an Outlook VSTO Add-in project.

Does Vsto work with Office 365?

There are two ways to have a Microsoft Office 365 integration: through the COM/VSTO add-in or an Office Add-in.

How do I add a VSTO for Outlook 2013 and 2016?

Steps for creating VSTO Add-in for Outlook 2013 and 2016Open Visual Studio 2017 and create a new project by clicking on File→New->Project. Give a proper name for the add-in in Name Textbox, and then choose a location from where you want to keep your add-in application. Finally, click on the OK button.

What is a VSTO add-in?

You can use VSTO Add-ins to automate Microsoft Office applications, extend features of the application, and customize the user interface (UI) of the application.


2 Answers

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.)

like image 138
Keith Avatar answered Oct 20 '22 02:10

Keith


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.

like image 25
Gary McGill Avatar answered Oct 20 '22 00:10

Gary McGill