EWS - custom extended properties and PidLidPropertyDefinitionStream?

Stephanie Kim 6 Reputation points
2021-02-25T22:03:20.393+00:00

Hi,

I am setting some extended properties through EWS. Below is the code I have. Now, I have to also set the "PidLidPropertyDefinitionStream" in order to get my code woking properly, but that property is a binary type. Can anyone give me sample code for setting that binary property? Any help would be hugely appreciated!

https://video2.skills-academy.com/en-us/office/client-developer/outlook/mapi/pidlidpropertydefinitionstream-canonical-property

var myCustomProp = new ExtendedPropertyDefinition(  
                                          DefaultExtendedPropertySet.PublicStrings,  
                                         "SkypeTeamsProperties",   
                                         MapiPropertyType.String);  
  
appointment.SetExtendedProperty(myCustomProp, "test value");  
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
526 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Glen Scales 4,431 Reputation points
    2021-02-28T23:13:58.477+00:00

    To set a Binary property just pass in a BinArray as the value and the Managed API will handle the rest. The value side of PidLidPropertyDefinitionStream is non-trival and you need to either copy an existing static value you know will always be the same or build your own code to construct the stream. (The stream itself contain underlying mapi properties of varying types).

                Byte[] StreamValue;
                var PidLidPropertyDefinitionStream = new ExtendedPropertyDefinition(
                                              DefaultExtendedPropertySet.Common,
                                             0x8540,
                                             MapiPropertyType.Binary);
    
                appointment.SetExtendedProperty(PidLidPropertyDefinitionStream, StreamValue);
    
    0 comments No comments