PC Review


Reply
Thread Tools Rate Thread

How do I delete Search folders?

 
 
Mark B
Guest
Posts: n/a
 
      26th Feb 2010
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)
{
}
}
}

 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      1st Mar 2010
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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)
> {
> }
> }
> }


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Completely delete/disable Search Folders feature OLK2K3 Canjura Microsoft Outlook Discussion 1 31st Jul 2009 03:23 PM
Cannot Delete Items from Other Folders that show Search results John Hn Microsoft Outlook Discussion 2 28th Jan 2008 07:27 PM
Hide/Delete Deleted Items & Search Folders Folders in Outlook 2003 =?Utf-8?B?anBzcHJpbmdhbGw=?= Microsoft Outlook VBA Programming 1 24th Apr 2006 02:51 PM
How to delete Suggested Matches from "Search for Files and Folders" boyboyds@yahoo.com Microsoft Outlook 0 9th Jan 2006 01:58 AM
Delete "Search Folders" =?Utf-8?B?QXJpZSBCbG9uaw==?= Microsoft Outlook 0 12th Nov 2004 09:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:55 AM.