PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Delete

Reply

Delete

 
Thread Tools Rate Thread
Old 04-11-2004, 04:41 AM   #1
Rizza
Guest
 
Posts: n/a
Default Delete


I am a newbie to Outlook VBA so please have patience.
What I need to create is code that I can attach to a button to delete emails
from another users folder and then to permanently delete them from the
deleted items.
Anything would be helpful.
Thanks in advance


  Reply With Quote
Old 04-11-2004, 08:47 PM   #2
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
 
Posts: n/a
Default RE: Delete

Use the GetDefaultSharedFolder method to return another user's mailbox, and
loop through the MAPIFolder object's Items collection to retrieve individual
MailItem objects and use the Delete method.

The FolderType parameter for GetDefaultSharedFolder will allow you to return
the Inbox or Deleted Items folder, amongst others.

You'd have to provide additional coding logic to find the message you just
deleted in the Deleted Items folder by either looping through Items and
comparing Subject property values, or use the Restrict method, and then
delete that message as well.

Or you could use CDO; the Message.Delete method allows you to bypass sending
the message to Deleted Items.

For more resources for programming with Outlook, start here:

Visual Basic and VBA Coding in Microsoft Outlook:
http://www.outlookcode.com/d/vb.htm

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

"Rizza" wrote:

> I am a newbie to Outlook VBA so please have patience.
> What I need to create is code that I can attach to a button to delete emails
> from another users folder and then to permanently delete them from the
> deleted items.
> Anything would be helpful.
> Thanks in advance
>
>
>

  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off