Group:  Microsoft Outlook ยป microsoft.public.outlook.program_vba
Thread: Deleting items from draft folder

Deleting items from draft folder
"John" <info[ at ]nospam.infovis.co.uk> 12/21/2008 8:26:45 PM
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


Re: Deleting items from draft folder
"Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> 12/22/2008 6:29:51 AM


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:

[Quoted Text]
> 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
Re: Deleting items from draft folder
"John" <info[ at ]nospam.infovis.co.uk> 12/26/2008 8:42:41 AM

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

"Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote in message
news:14mouz2bqw8la.1o8glqtinwbr9.dlg[ at ]40tude.net...
[Quoted Text]
>
>
> 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:
>
>> 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


Re: Deleting items from draft folder
"Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> 12/27/2008 2:22:31 PM


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:

[Quoted Text]
> 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
>
> "Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote in message
> news:14mouz2bqw8la.1o8glqtinwbr9.dlg[ at ]40tude.net...
>>
>>
>> 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:
>>
>>> 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

Home | Search | Terms | Imprint
Newsgroups Reader