G
Guest
I have a plugin which creates a folder that I only want to exist during the
time Outlook is running, so I've been experimenting with various ways to
delete this folder. Couple questions,
1) Using MAPIFolder.Delete() seems to work every time, but the folder ends
up in the Deleted Items folder...is there a way through the OOM to bypass
Deleted Items when deleting a folder?
2) Using Redemption's RDOFolder.Delete() is kind of hit or miss. What I've
noticed is that sometimes, right after creating the folder, I can delete it,
but most often when caling this method, I get a MAPI_E_EXTENDED_ERROR
(ErrorCode=-2147221223, Message="Error in IMAPIFolder:eleteFolder:
MAPI_E_EXTENDED_ERROR") . If I keep trying to delete this folder (i have a
test button calling the delete method), it will eventually work after about a
minute or so. Could this be the result of some kind of Exchange
synchronization holding onto the folder?
What is the best way to delete a folder? sample code follows for the
RDODelete call I'm using:
public bool DeleteArchiveSearchFolder(string sArchiveFolder)
{
if (!_IsValid() || sArchiveFolder == null)
return false;
// Have to find out if the thing is already here
RDOFolders fIPMFolders = m_DefaultMsgStore.IPMRootFolder.Folders;
foreach (RDOFolder f in fIPMFolders)
{
if (f.Name.Equals(sArchiveFolder,
StringComparison.CurrentCultureIgnoreCase))
{
f.Delete();
return true;
}
}
return false;
}
time Outlook is running, so I've been experimenting with various ways to
delete this folder. Couple questions,
1) Using MAPIFolder.Delete() seems to work every time, but the folder ends
up in the Deleted Items folder...is there a way through the OOM to bypass
Deleted Items when deleting a folder?
2) Using Redemption's RDOFolder.Delete() is kind of hit or miss. What I've
noticed is that sometimes, right after creating the folder, I can delete it,
but most often when caling this method, I get a MAPI_E_EXTENDED_ERROR
(ErrorCode=-2147221223, Message="Error in IMAPIFolder:eleteFolder:
MAPI_E_EXTENDED_ERROR") . If I keep trying to delete this folder (i have a
test button calling the delete method), it will eventually work after about a
minute or so. Could this be the result of some kind of Exchange
synchronization holding onto the folder?
What is the best way to delete a folder? sample code follows for the
RDODelete call I'm using:
public bool DeleteArchiveSearchFolder(string sArchiveFolder)
{
if (!_IsValid() || sArchiveFolder == null)
return false;
// Have to find out if the thing is already here
RDOFolders fIPMFolders = m_DefaultMsgStore.IPMRootFolder.Folders;
foreach (RDOFolder f in fIPMFolders)
{
if (f.Name.Equals(sArchiveFolder,
StringComparison.CurrentCultureIgnoreCase))
{
f.Delete();
return true;
}
}
return false;
}