![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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) { } } } |
Ads |
#2
|
|||
|
|||
![]()
Does the same code run without errors if you run it some other place in your
addin? If so try handling the Explorer.Close() event and if there are no other Explorers and no open Inspectors then call your remove code then. See if that works. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Mark B" wrote in message ... 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) { } } } |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Instant Search, Advanced Find, Search Folders, and Windows Desktop | [email protected] | Outlook - General Queries | 2 | October 31st 08 07:37 PM |
Outlook 2003 - Search folders - adding criteria to an old mail search? | Dustin Emhart | Outlook - General Queries | 0 | December 20th 06 03:39 PM |
What are "Search Folders.dbx" and is it ok/safe to delete them? | sheana | Outlook Express | 3 | November 18th 06 01:31 AM |
Hide/Delete Deleted Items & Search Folders Folders in Outlook 2003 | jpspringall | Outlook and VBA | 1 | April 24th 06 03:51 PM |
How to delete Suggested Matches from "Search for Files and Folders" | [email protected] | Outlook - General Queries | 0 | January 9th 06 02:58 AM |