vba - Creating an empty collection of Outlook.Items -


i have vba macro code in this:

dim myfounditems outlook.items set myfounditems = mycalendars.restrict("[customuserproperty] = '" & sid & "'") 

where customuserproperty user property adding in macro (few lines after restriction). on first run of macro error property doesn't exist. thinking setting error handler set myfounditems empty collection. cannot achieve in way!

i've tried using below code, causes error!

set myfounditems = new collection 

maybe know how set myfounditems empty collection or better way check if userproperty created?

you can't create new items instance using new keyword. instead, have use items property of folder class.

the cause of issue can't reference user property using name in filter query. instead, have use dasl query following 1 (vba):

criteria = "@sql=" _    & chr(34) & "http://schemas.microsoft.com/mapi/string/" _    & "{00020329-0000-0000-c000-000000000046}/customuserproperty" & chr(34) _    & " = 'microsoft'" 

see filtering items using query keywords more information. may find office developer: how programmatically restrict or filter “to” property using outlook object model? page helpful.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -