Welcome to Lockergnome.com!
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Read/write permissions on c:\ProgramData

 
   Home -> Office -> Program Add-Ins RSS
Next:  Program Add-Ins: Automating Outlook 2007 - clicking a button on toolbar  
Author Message
duncanparsons




Joined: Mar 03, 2008
Posts: 1



(Msg. 1) Posted: Mon Mar 03, 2008 4:55 am
Post subject: Read/write permissions on c:\ProgramData

Hi

I've inherited a bit of code and told to get it working. The bones of the code seems to be OK, apart from how the original coder decided to store the add-ins settings.

Basically a folder is got from using My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData (C:\ProgramData on a std Vista install), and there is an xml file placed there during installation which has default settings. The file is read using a data reader's ReadXML method, and elsewhere in the code values are ascertained with .Tables(0).

All looks good!

If I write a stand alone app to do all this, targetting the same file, all goes well, and I can iterate values as needed. If I call WriteXML, I can write as needed.

When I run the code in the context of an addin, the ReadXML doesn't appear to read the file, as .Tables.count returns zero and any attempted call to WriteXML brings a security exception that there aren't rights to the file.

OK, so I check the rights to the folder, Administrators have read/write, Everyone has only read.

In the code, the original author has placed a AppDomain.CurrentDomain.SetPrincipalPolicy(Principal.PrincipalPolicy.WindowsPrincipal) in an attempt to get elevation to perform the required task... but it doesn't appear to be doing the job.

So, basically, I can do what I need to do if the code is being run directly with the users credentials, but when being run in the context of Outlook, it loses rights. I guess this is because the addin inherits its hosts permissions - but is there a way that I can get the permissions I need to deal with the file.

From what I can see the original author has done the responsible things that are recommended for Vista, I've looked around at various posts that searches return, but to no avail.

The code appears to work OK on XP.

Any ideas?

Duncan
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Program Add-Ins All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 General
 Microsoft Windows XP
 Microsoft Windows Vista
 Microsoft Windows (other)
  Microsoft Office
 Microsoft Office (other)
 Computer Security
 Linux
 Movies


[ Contact us | Terms of Service/Privacy Policy ]