M
Mark B
OL2007, VSTO
On Addin exit, I am trying to delete all search folders I previously
programmatically created so that next time OnAddin startup, I can recreate
them cleanly (in order to try and workaround unexpected behavior such as
folder italicization after 1 or 2 days).
When I walk through the code I see an exception generated at
existingFolder.Delete() stopping the delete:
"Cannot delete this folder. Right-click the folder, and then click
Properties to check your permissions for the folder. See the folder owner or
your administrator to change your permissions."
Any ideas on why this would be happening and how to remedy it?
public void Remove()
{
if (this.folderEntryId != null)
{
Outlook.Application olApp;
olApp = Globals.ThisAddIn.Application;
try
{
Outlook.MAPIFolder existingFolder =
olApp.GetNamespace("MAPI").GetFolderFromID(
this.folderEntryId, Type.Missing);
if (existingFolder != null)
existingFolder.Delete();
}
catch (Exception)
{
}
}
}
On Addin exit, I am trying to delete all search folders I previously
programmatically created so that next time OnAddin startup, I can recreate
them cleanly (in order to try and workaround unexpected behavior such as
folder italicization after 1 or 2 days).
When I walk through the code I see an exception generated at
existingFolder.Delete() stopping the delete:
"Cannot delete this folder. Right-click the folder, and then click
Properties to check your permissions for the folder. See the folder owner or
your administrator to change your permissions."
Any ideas on why this would be happening and how to remedy it?
public void Remove()
{
if (this.folderEntryId != null)
{
Outlook.Application olApp;
olApp = Globals.ThisAddIn.Application;
try
{
Outlook.MAPIFolder existingFolder =
olApp.GetNamespace("MAPI").GetFolderFromID(
this.folderEntryId, Type.Missing);
if (existingFolder != null)
existingFolder.Delete();
}
catch (Exception)
{
}
}
}