次の方法で共有


How to get Extended MAPI Properties in the GetItem Exchange Web Service call?

We can get/set Extended MAPI Properties using Exchange Web Services for Exchange Server 2007/2010.

Here is sample code snippet to get value for CleanGlobalObjectID via GetItem call of Exchange Web Services:

NOTE: Following programming examples is for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This sample code assumes that you are familiar with the programming language being demonstrated and the tools used
to create and debug procedures.

 private void fnGetCalItem()
         {
             // Form the GetItem request
             GetItemType getRequest = new GetItemType();
  
             // Define which item properties are returned in the response
             ItemResponseShapeType itemProperties = new ItemResponseShapeType();
             itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;
  
             // Add properties shape to request
             getRequest.ItemShape = itemProperties;
  
             // Set the itemID of the desired item to retrieve
             ItemIdType id = new ItemIdType();
             id.Id = itemID;
             getRequest.ItemIds = new ItemIdType[] { id };
  
  
             PathToExtendedFieldType[] pteft = new PathToExtendedFieldType[1];
  
             pteft[0] = new PathToExtendedFieldType();
             
             //Add CleanGlobalObjectID extended property 
             pteft[0].PropertyId = 35;
             pteft[0].PropertyIdSpecified = true;
             pteft[0].PropertySetId  = "6ED8DA90-450B-101B-98DA-00AA003F1305" ; 
             pteft[0].PropertyType = MapiPropertyTypeType.Binary;
             itemProperties.AdditionalProperties = pteft;
  
             // Send the listing (find) request and get the response
             GetItemResponseType getResp = binding.GetItem(getRequest);
  
             // Get the response message
             if (getResp.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success)
             {
                 ItemInfoResponseMessageType iirmt = getResp.ResponseMessages.Items[0] as ItemInfoResponseMessageType;
                 itemGCOID = iirmt.Items.Items[0].ExtendedProperty[0].Item.ToString() ;
              }
             else
             {
                 Console.WriteLine(getResp.ResponseMessages.Items[0]);
             }
         }

 

Articles referenced for the above sample code:

- EWS: UID not always the same for orphaned instances of the same meeting. https://blogs.msdn.com/mstehle/archive/2009/09/02/ews-uid-not-always-the-same-for-orphaned-instances-of-the-same-meeting.aspx

**PidLidCleanGlobalObjectId Canonical Property**  
[https://msdn.microsoft.com/en-us/library/cc839502.aspx](https://msdn.microsoft.com/en-us/library/cc839502.aspx "https://msdn.microsoft.com/en-us/library/cc839502.aspx")

Hope this helps!

Comments

  • Anonymous
    June 01, 2010
    you are just awesome, it worked for me, was trying it for last 72 hours and have browsed around 50 blogs. Just this one worked.... thanks a lot.