GabrielMA
Posts: 15
Joined: 2014-05-14
|
Hi,
I developed the add-on and then I did the setup file.
When I tried to execute the add-on in Explorer I have a problem writting a file into the install add-on path.
path: C:\Program Files\XXX
I obtain the path like this:
string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
FileInfo fileinFo = new FileInfo(codeBase.Replace("file:///", String.Empty));
this.configFolder = fileinFo.Directory.FullName.ToString();
exception: UnauthorizedAccesException
Could you tell me how save file in this path without throw the exception?
How I can give permissions to the add-on so I can write in this directory?
Thanks. |
|
Andrei Smolin
Add-in Express team
Posts: 18652
Joined: 2006-05-11
|
|
GabrielMA
Posts: 15
Joined: 2014-05-14
|
Good morning Andrei Smolin,
I have reviewed reference http://www.add-in-express.com/creating-addins-blog/2009/06/12/internet-explorer-protected-mode-api/ for writing files in protected mode. I can?t see how to implement exactly what I want. I mean?Â?Ð??
What I want to do is to write an xml.
if (instance.GetFileLocked() == 0)
{
instance.SetFileLocked(1);
try
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create(this.configurationData.GetConfigFilePath(), settings);
// this.configurationData.GetConfigFilePath() This is a pre define path. I do not need SaveFileDialog
writer.WriteStartDocument();
writer.WriteComment("Configuracion de plugin IE");
writer.WriteStartElement("Config");
writer.WriteElementString("started", this.configurationData.Started.ToString());
writer.WriteElementString("automaticchek", this.configurationData.IsAutomaticChek.ToString());
writer.WriteElementString("intervalchek", this.configurationData.IntervalChek.ToString());
writer.WriteElementString("lastclean", this.configurationData.LastClean.ToString());
writer.WriteElementString("serviceendpoint", this.configurationData.ServiceEndPoint.ToString());
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
finally
{
instance.SetFileLocked(0);
}
}
How could I do this in protected mode? I have studied the reference you provided me, but I don?Â?Ð?ét know how adapting it to do what I need.
What ?Â?Ð?ìstate?Â?Ð?í must I add to the invoke to save the file using ADXIEProtectedModeAPI?
AddinExpress.IE.ADXIEProtectedModeAPI AddinExpress.IE.ADXIEProtectedModeAPI protectedModeAPI = new ();
protectedModeAPI.SaveFile (?????, tmpFilePath);
The final file path is pre define. I do not need to use SaveFileDialog.
Thanks and best regards,
Gabriel. |
|
Andrei Smolin
Add-in Express team
Posts: 18652
Joined: 2006-05-11
|
Hello Gabriel,
I see. Writing to Program Files is disabled for a standard user by default. You need to contact an administrator if you really need your users to be able to write to this folder. Typically, configuration information is user-specific and it can be stored in the user's profile.
Andrei Smolin
Add-in Express Team Leader |
|
GabrielMA
Posts: 15
Joined: 2014-05-14
|
Hi Andrei,
Thanks for the information. With this I managed the add-on.
Thanks and best regards,
Gabriel. |
|