3.1 Creating Extended Properties

The following example creates and sends mail with three extended properties.

The client constructs the request XML and sends the newly created message to the server. The message has three custom properties. The first custom property is named Expiration Date and has a string value set to a time of "12/25/2009 3:25:15 PM". The second custom property is named Employee Type and has a string value set to "Part Time". The third custom property is named MyFlag and has an integer value set to "4". Each of these extended properties becomes part of the message. The PropertySetId attribute values are GUIDs, and are shown in the following examples.

   <?xml version="1.0" encoding="utf-8"?>
   <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
         xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Header>
       <t:RequestServerVersion Version="Exchange2013" />
     </soap:Header>
     <soap:Body>
       <m:CreateItem MessageDisposition="SendAndSaveCopy">
         <m:SavedItemFolderId>
           <t:DistinguishedFolderId Id="sentitems" />
         </m:SavedItemFolderId>
         <m:Items>
           <t:Message>
             <t:Subject>Interesting</t:Subject>
             <t:Body BodyType="HTML">The merger is finalized.</t:Body>
             <t:ExtendedProperty>
               <t:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e" 
                  PropertyName="Expiration Date" PropertyType="String" />
               <t:Value>12/25/2009 3:25:15 PM</t:Value>
             </t:ExtendedProperty>
             <t:ExtendedProperty>
               <t:ExtendedFieldURI PropertySetId="24a3075f-a8b7-4181-a9ed-708a947b8765" 
                  PropertyName="Employee Type" PropertyType="String" />
               <t:Value>Part Time</t:Value>
             </t:ExtendedProperty>
             <t:ExtendedProperty>
               <t:ExtendedFieldURI PropertySetId="75a5486f-9267-49ca-9b4e-3d04ca9ec179" 
                  PropertyName="MyFlag" PropertyType="Integer" />
               <t:Value>4</t:Value>
             </t:ExtendedProperty>
             <t:ToRecipients>
               <t:Mailbox>
                 <t:EmailAddress>User1@Contoso.com</t:EmailAddress>
               </t:Mailbox>
               <t:Mailbox>
                 <t:EmailAddress>User2@Contoso.com</t:EmailAddress>
               </t:Mailbox>
             </t:ToRecipients>
           </t:Message>
         </m:Items>
       </m:CreateItem>
     </soap:Body>
   </soap:Envelope>

The server constructs the response XML and sends it to the client, as shown in the following example.

   <?xml version="1.0" encoding="utf-8"?>
   <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
     <s:Header>
       <h:ServerVersionInfo MajorVersion="14" 
           MinorVersion="1" 
           MajorBuildNumber="63" 
           MinorBuildNumber="0" 
           Version="Exchange2013" 
           xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" 
           xmlns="http://schemas.microsoft.com/exchange/services/2006/types" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
     </s:Header>
     <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <m:CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
             xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
           <m:CreateItemResponseMessage ResponseClass="Success">
             <m:ResponseCode>NoError</m:ResponseCode>
             <m:Items />
           </m:CreateItemResponseMessage>
         </m:ResponseMessages>
       </m:CreateItemResponse>
     </s:Body>
   </s:Envelope>
Show: