Folder Delete issue

N

Neetu

In our add-in we are creating folders. After search operation ( one of the
feature provided by our addin in outlook by using windows forms) we have to
recreate folder structure again deleting previous created folders.
we are deleting folders and those old folders get moved to deleteitems
folders of outlook. after certain no of search , size of deleteitems folders
exceeds some limit and we are no more state to create of new folders. as some
folders still exist inside our root folder ( which we are keeping root folder
constant not deleting for each search).

we looked for another solution like
we moved all our deleted folder into a temp folder and moving that temp
folder ("TempFolder" ) to deleteditem folder


we added folder add event for deleteitem folder

mobjDeletedFolder.FolderAdd += new
FoldersEvents_FolderAddEventHandler(DeletedFolderAdd);


private void DeletedFolderAdd(MAPIFolder Folder)
{
if (Folder.Name.Contains("TempFolder"))
{
Folder.Delete();
Marshal.ReleaseComObject(Folder);
Folder = null;
}
}

and then from there we deletes temp folder.

this work fine.. however this gives a GUI issue. as our search form is
opened using showdialog method.. deletion of temp folder from
deleteitemfolder gives deletion process with hanged state for some time.

I would like to know is there any way to delete folders directly from main
folder with out moving to deleteditem folder or is there any way to hide
deletion process to user.. for smooth UI experience?
 
K

Ken Slovak - [MVP - Outlook]

The Outlook object model has no "hard delete" method. You can monitor the
Deleted Items folder and also handle the ItemAdd event on the Items
collection of the Deleted Items folder and use code to delete items and
folders from Deleted Items.

If you were to use Redemption (www.dimastr.com/redemption) you could use its
hard delete flag when you delete the folders. You can't use CDO 1.21 or
Extended MAPI to do that using managed code, both APIs are unsupported for
managed code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top