none
EWS to create userproerties similar to VSTO addin RRS feed

  • Question

  • Hi,

    in our vsto addin for creating custom properties fro an appointment  we are using userproperties object. which works fine.

     Public Sub SetReference(ByVal Reference As String)
            Dim UserProperties As Outlook.UserProperties
            Dim MyReference As Outlook.UserProperty
            UserProperties = AppItem.UserProperties
            MyReference= UserProperties.Find("MyReference")
            If MyReferenceIs Nothing Then MyReference= UserProperties.Add("MyReference", OlUserPropertyType.olText)
            MyReference.Value = Reference
            NAR(MyReference)
            NAR(UserProperties)
            ReleaseMemory()
        End Sub

    Now we are trying to similar sort of thing through EWS and using extendedProperty definition, but no luck yet as properties are not being saved in userproperties interface and by using above SetReference method i can not get custom property

    i tried checking in outlook spy and i am trying to use similar guid which outlook uses to store userproperties

    Guid MyPropertySetId = new Guid("{0006303D-0000-0000-C000-000000000046}");

                // Create a definition for the extended property.
                ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(MyPropertySetId, 
                                                                                                       "MyReference", 
                                                                                                       MapiPropertyType.String);

                // Create an email message that you will add the extended property to.
                Appointment message = new Appointment(service);
                message.Subject = "Saved with custom ExtendedPropertyDefinition.";
                message.Body = "The expiration date is contained within the extended property.";
                message.Start = DateTime.Now;
                message.End = message.Start.AddMinutes(30);
                //message.ToRecipients.Add("user@contoso.com");

                // Add the extended property to an email message object.
                message.SetExtendedProperty(extendedPropertyDefinition, "111111111111111");

                try
                {
                    // Save the email message as a draft. This results in a CreateItem call to
                    // EWS.
                    message.Save();
                    Console.WriteLine("Saved email with custom extended property.");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: {0}", ex.Message);
                }

    not sure what i am missing here. Please help

    Thanks


    • Edited by Nitrup Tuesday, April 4, 2017 9:09 PM
    Tuesday, April 4, 2017 8:15 PM

Answers

All replies