none
SelectedMailingAddress - Exchange Webservices RRS feed

  • Question

  • Hello,

    I am using Exchange Webservices to populate our Outlook users contacts folders.

    The ContactType object don’t have all the attributes required, so for that I am using the ExtendedPropertyType object method. This seems to work fine for properties like Gender, FTPsite, ect.

    For some reason I just can’t get to work for the SelectedMailingAddress property. I use the same code structure as the other, the moment I add the SelectedMailingAddress property bit of code(below), it falls over. Any ideas?

    extendedPropertyType = new ExtendedPropertyType()

    {

    ExtendedFieldURI = new PathToExtendedFieldType()

    {

    PropertyTag = "0x8022",

    PropertyType = MapiPropertyTypeType.Integer

    },

    Item = 1

    };

    extendedPropertyTypes.Add(extendedPropertyType);

    Regards

    WDV

    Friday, June 1, 2012 8:52 AM

Answers

  • This property is a Named property not a tagged property see http://msdn.microsoft.com/en-us/library/cc979184.aspx for a discussion of the differences between the two.

    So what you need to do is use the PidLidPostalAddressId definition from http://msdn.microsoft.com/en-us/library/cc815430.aspx

    eg

                PathToExtendedFieldType extendedField = new PathToExtendedFieldType();
                extendedField.DistinguishedPropertySetId =  DistinguishedPropertySetType.Address;
                extendedField.DistinguishedPropertySetIdSpecified = true;
                extendedField.PropertyType = MapiPropertyTypeType.Integer;
                extendedField.PropertyId = 32802;
                extendedField.PropertyIdSpecified = true;


    However you don't really need to do this you can just use the Strong Type eg

    ontactItemType cnt = new ContactItemType();
    cnt.PostalAddressIndexSpecified = true;
    cnt.PostalAddressIndex = PhysicalAddressIndexType.Home;

    Cheers
    Glen

    • Marked as answer by WDV-KT17 Wednesday, June 20, 2012 4:16 PM
    Monday, June 4, 2012 7:58 AM