D
Dave Townsend
I am experiencing an odd problem trying to delete a temporary folder
that I create in outlook. Basically I am grabbing a load of contacts,
storing them in a temporary folder to allow an automated mail merge to
take place, then I want to delete the temporary folder. When I call the
folder's delete method of course it simply moves the folder to the
deleted items folder. I then go through every folder in the deleted
items folder and call delete on each of those (I am working in a
seperate store to everything else). When I call the delete method on the
deleted folder I get this exception:
"Unable to 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".
In a nutshell here is my code:
folder = store.Folders.Add("Temporary Fax Mailing
List",Outlook.OlDefaultFolders.olFolderContacts);
// Stores contacts in folder (all are ComReleased after they are saved).
folder.Delete();
System.Runtime.InteropServices.Marshal.ReleaseComObject(folder);
folder=null;
Outlook.MAPIFolder di = store.Folders["Deleted Items"];
try
{
foreach (Outlook.MAPIFolder f in di.Folders)
{
f.Delete();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
Anybody know what is causing this?
Dave
that I create in outlook. Basically I am grabbing a load of contacts,
storing them in a temporary folder to allow an automated mail merge to
take place, then I want to delete the temporary folder. When I call the
folder's delete method of course it simply moves the folder to the
deleted items folder. I then go through every folder in the deleted
items folder and call delete on each of those (I am working in a
seperate store to everything else). When I call the delete method on the
deleted folder I get this exception:
"Unable to 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".
In a nutshell here is my code:
folder = store.Folders.Add("Temporary Fax Mailing
List",Outlook.OlDefaultFolders.olFolderContacts);
// Stores contacts in folder (all are ComReleased after they are saved).
folder.Delete();
System.Runtime.InteropServices.Marshal.ReleaseComObject(folder);
folder=null;
Outlook.MAPIFolder di = store.Folders["Deleted Items"];
try
{
foreach (Outlook.MAPIFolder f in di.Folders)
{
f.Delete();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
Anybody know what is causing this?
Dave