none
iCloud contact folder: UserDefinedProperties.Add breaks (Outlook 2010) RRS feed

  • Question

  • Hi,

    the following code applied to the iCloud contact folder (FolderPath = "\\iCloud\Contacts", automatically created when iCloud program (version 2.1.1) is installed) breaks in OL2010 VBA:

    Dim objProperty As UserDefinedProperty
    Set objProperty = mySubFolder.UserDefinedProperties.Add("Issue?", olText)

    However, the UserProperties do work, where these fields do not appear to be available for the .Find() method:

    Dim myContact as ContactItem
    myContact.UserProperties.Add "Issue?", Outlook.OlUserPropertyType.olText

    My question: Any chance to make the UserDefinedProperties.Add method happen to the iCloud contact folder? My aim is to apply the .Find() method to all contacts in the iCloud contact folder which is much faster than looping through the set of contacts.

    Thx for your help!

    Best,

    J.

    PS: This is my first posting here. Apologies if this is not correct in any way.

    Wednesday, April 3, 2013 10:56 AM

Answers

All replies

  • Do you get an error when you call mySubFolder.UserDefinedProperties.Add?

    You can still use a user defined property in Items.Find without adding it to the folder defined fields first, but you will have to specify the DASL property name (e.g. "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Issue?"). You will need to prefix your search query with @SQL=.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by Jannick Asmus Wednesday, April 3, 2013 3:30 PM
    Wednesday, April 3, 2013 1:34 PM
  • This was really helpful!

    An error occurs when calling mySubFolder.UserDefinedProperties.Add. But when defining a UserProperty on item level, the following filter works well with the .Find() method (see here http://msdn.microsoft.com/en-us/library/office/cc513841%28v=office.12%29.aspx#SearchingOutlookData_OutlookQueryLanguages > Custom Properties in a DASL Query):

    VBA:
    
    sFilter = "@SQL=" + """" + "http://schemas.microsoft.com/mapi/string/"
        sFilter = sFilter + "{00020329-0000-0000-C000-000000000046}/"
        sFilter = sFilter + strFieldName
        sFilter = sFilter + "/0x0000001f"
        sFilter = sFilter + """"
        sFilter = sFilter + " = '" + strLookForMe + "'"
    Thanks for your help! Much appreciated.

    Best,

    J.

    Wednesday, April 3, 2013 3:29 PM