0
votes

Is there a way to persist user properties across to the appointment invitees/locations calendars?

I have created a form region for appointments, with some extra form fields on. Upon the appointment write event, I can save the form region data as user properties against the appointment. From the senders' point of view, these properties persist when the item is opened up, and can be updated etc.

However, any invitees on the appointment, or any meeting rooms/locations included can receive the appointment BUT the user properties don't seem to carry across with the item. Why is this, and can it be worked around?

The only one I could think of is to persist the user properties in a database also and load them upon item open with the FormRegion_Showing method. That's not ideal though as the whole point was to keep it all in outlook.

I'm using Outlook 2010 and Visual Studio 2015.

I came across this post which pretty much says it can't be done, however that is from 2011 and I can't find anything more recent that's relevant to this particular scenario.

Some cut down code - the Form Region:

// Form region class
[Microsoft.Office.Tools.Outlook.FormRegionMessageClass(Microsoft.Office.Tools.Outlook.FormRegionMessageClassAttribute.Appointment)]
[Microsoft.Office.Tools.Outlook.FormRegionName("Namespace.MyFormRegion")]
public partial class MyFormRegionFactory
{

}

private void MyFormRegion_FormRegionShowing(object sender, System.EventArgs e)
{
    Outlook.AppointmentItem appointment = this.OutlookItem as Outlook.AppointmentItem;
    this.appointment.Write += Appointment_Write;
}

private void Appointment_Write(ref bool Cancel)
{
    Outlook.ItemProperties CateringData = this.appointment.ItemProperties;
    var Serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

    Outlook.ItemProperty MeetingNameProperty = CateringData.Add("MeetingName", Outlook.OlUserPropertyType.olText, true);
    MeetingNameProperty.Value = this.MeetingName.Text;

    // More properties saved
    appointment.Save();
}

and in the addin class:

public partial class ThisAddIn
{
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Application.ItemSend += Application_ItemSend;
    }

    private void Application_ItemSend(object Appointment, ref bool Cancel)
    {
        // Appointment is an AppointmentItem that has just been saved.
        // How does this relate to the outgoing item that ends up in the 
        // Sent Items folder???
    }
}

Using Outlook Spy the user properties are not in the item within the Sent Items. The form region does appear when opening the item from one of the invitees calendars, but the user properties are not there.

1
Are you sending between two Exchange mailboxes? Or through SMTP?Dmitry Streblechenko
The invitees are all internal so it's through the same exchange server, I think.John Joseph
Having read a bit since posting this question it looks like setting an ExtendedProperty on the item using EWS might be a way to do it? Presumably that would be something along the lines of attaching the properties to the item after calling AppointmentItem.Save in the add-in?John Joseph
Do you see the user properties using OutlookSpy on the MeetingRequest object in the Sent Items folder?Dmitry Streblechenko
I've just installed it - it doesn't look like they are, no. But also the form region is not present on the sent item (the form region is attached for appointment items only)John Joseph

1 Answers

1
votes

So, after lots of head scratching and modifications, and after using Outlook Spy with the help of Dmitry (http://www.dimastr.com/outspy/home.htm) to inspect User Properties I realised that I had been trying to set a property name that happened to be in use already by Outlook internally (MeetingType)

After changing the name of that property, all the other user properties now persist in both the sent items and invitees' calendars.

For anyone else coming across this same issue where properties don't persist, check your property names with those set in Outlook already, could save you hours of headache!