Deleting items from draft folder

J

John

Hi

I need to delete items from draft folder based on value of a user property
xyz = "abc". The problems I have are;

1. How to access items in Draft folder?

2. How to select items based on condition user property xyz with value
"abc"?

3. How to delete all items?

Any help in achieving this would be appreciated.

Thanks

Regards
 
M

Michael Bauer [MVP - Outlook]

1. See the GetDefaultFolder function.

2. Loop backwards through the Items collection of the folder, and check each
item's UserProperties collection. Sample for a backward loop:
Dim i&
For i=Items.Count To 1 Step-1
....
Next

3. If you find the value in the UserProperties collection, call the item's
Delete method.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sun, 21 Dec 2008 20:26:45 -0000 schrieb John:
 
J

John

Hi

I am using below code;

For I = oItems.Count - 1 To 0 Step -1
oItems(I).delete()
End If

The problem is one element is always left from deletion. What am I doing
wrong?

Thanks

Regards
 
M

Michael Bauer [MVP - Outlook]

John, please compare your code with my suggested loop. Do you see what's
wrong?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 26 Dec 2008 08:42:41 -0000 schrieb John:
 
O

onesourcetalent

onetalentsource


John said:
Hi

I need to delete items from draft folder based on value of a user property
xyz = "abc". The problems I have are;

1.

How to access items in Draft folder?
 

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