Konrad Viltersten
Konrad Viltersten

Reputation: 39138

What directory (if any) should I use to store settings file for my add-in?

I've developed an add-in and now I'd like to enable it to store/retrieve settings upon the launch of Outlook. I've checked the current working directory using Environment.CurrentDirectory but when I tried to File.WriteAllText to it, I failed due to access rights. So, my question is twofold.

  1. Will any directory suffice or is there a recommended one?
  2. Do I need to store the settings in a local file or is there a neater method?

Upvotes: 1

Views: 56

Answers (1)

user1672517
user1672517

Reputation:

I use the Environment class as follows.

String dir = Environment.GetFolderPath(
  Environment.SpecialFolder.ApplicationData);

A bit lengthy syntax but it does the job well. Not sure if you'll have full access rights from an add-in, though. Also, It'd be good to know if somebody will suggest a better storage method. Once I used a web service until I discovered that my user often will do his job while sitting on the train (read: off-line). It worked unless he didn't reboot his machine before getting on board.

Upvotes: 2

Related Questions