locked
Creating extended property using EWS and access it from Outlook Add-in RRS feed

  • Question

  • I am currently working on EWS to have some integration of our company application with Exchange 2010.  I am using EWS to create appoinment to Exchange 2010 and it works fine; but recently I tried to add some custom/extended property when creating the appointment, below is my code to add the extended property.

    Dim customField As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "MyCustomField", MapiPropertyType.String)
    
    appointment.SetExtendedProperty(customField, "CustomFieldValue")
    

    The above codes able to create the custom field to the appointment.  

    Now here is my problem.  When I open up the appointment in Outlook that I created and go to "Developer > Design This Form", then "All Fields" tab, I only see the custom field I created in the "User-defined field in folder" but not in "User-defined field in this item".

    I also making an Outlook Add-in to react to the custom field that I created using the EWS when user opens up the appointment in Outlook, when I tried to look for the custom field, couldn't find the custom field, because the custom field is created in "User-defined field in folder" but not in "User-defined field in this item".

    This is the codes in the Outlook Add-in and will execute when user opens an apointment in Outlook.  But because the custom field is not in "in this item", the .Find() returns Nothing.

     

    Dim appt As Outlook.AppointmentItem
    appt = TryCast(inspector.CurrentItem, Outlook.AppointmentItem)
    
    If appt.UserProperties.Find("MyCustomField") Is Nothing Then
     'Some actions
    Else
     'Some actions
    End If
    

     

    What I want to achieve is to create an appointment with the custom field (extended property) using EWS, and then read the custom field (extended property) in Outlook Add-in when user open the appointment in Outlook.

    EDIT:

    The value that i assigned to the custom field using EWS is shown in the "User-defined field in folder".  How to I retrieve the value using Outlook Add-in? Maybe I can retrieve the value and add the custom field to the item?

    Thanks.



    • Edited by Ah Lun Monday, May 16, 2011 1:34 AM Edit
    Monday, May 16, 2011 1:22 AM

Answers