none
Send Event Capture - Modify Meeting Request "Location"

    Question

  • I have written an addin for Outlook 2010 where on the send button event I need to change the meeting request's "location" details. I am able to change for the senders side but the recipients do not see the changes. Here is the code that I have written using C# to change the subject and location.  Note: Subject is changed as expected on both the senders and recievers end.

    //Subject

    // For senders subject text

    objMeetingItem.GetAssociatedAppointment(false).Subject += " " + " Change";

    objMeetingItem.GetAssociatedAppointment(false).Save();

    //Location

    //For senders location text

    objMeetingItem.GetAssociatedAppointment(false).Location += " " + " Change";

    objMeetingItem.GetAssociatedAppointment(false).Save();

    Now, here this is no property for changing the location of the receiver as it is for the subject.

    I am using VS 2010 to develop the addin.

    Thanks in advance for the help

    Wednesday, February 27, 2013 1:24 PM

Answers

  • Thank you very much guys for the response.

    Dmitry, thank you for pointing out the inefficiency, I have modified the code as per your expertise.

    I do not see the Location being changed on either senders calendar or the recievers.

    Here is what I am doing

    const string strLocationDASL = <URL YOU PROVIDED>

    Outlook.PropertyAccessor pa = objMeetingItem.PropertyAccessor;

    pa.SetProperty(strLocationDASL, "Changed Location");

    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Wednesday, February 27, 2013 11:23 PM
  • check in sent items folder if your meeting request actually sent contains changed location (VBA, OutlookSpy)
    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Thursday, February 28, 2013 4:55 AM
  • Thank you Damian, you were right.

    I am able to get the Location field changed for both Sender as well as the receiver. Receiver will have the changed location with the Property Accessor property of the MeetingItem object and sender has it with the AssociatedAppointment of the Meeting item object.

    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Thursday, February 28, 2013 2:16 PM

All replies

  • AssociatedAppointment is the object located in sender's calendar - you have to also make changes in meeting request that is actually sent.
    Wednesday, February 27, 2013 1:40 PM
  • To expand on what Damian said, since the MeetingItem object does not expose the Location property, you will need to set the Location using MeetingItem.PropertyAccessor. The Location property DASL name is "http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8208001F".

    Also, your code above is as inefficient as it gets and the only reason it works is because Outlook likes to cache objects and the .Net garbage collection does not immediately run: do not call GetAssociatedAppointment multiple times. Besides beeing inefficient, you migth get a brand new object every time you call it, so you can end up calling Save on an object different from the one that you set the Subject property on.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Wednesday, February 27, 2013 4:46 PM
  • Thank you very much guys for the response.

    Dmitry, thank you for pointing out the inefficiency, I have modified the code as per your expertise.

    I do not see the Location being changed on either senders calendar or the recievers.

    Here is what I am doing

    const string strLocationDASL = <URL YOU PROVIDED>

    Outlook.PropertyAccessor pa = objMeetingItem.PropertyAccessor;

    pa.SetProperty(strLocationDASL, "Changed Location");

    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Wednesday, February 27, 2013 11:23 PM
  • check in sent items folder if your meeting request actually sent contains changed location (VBA, OutlookSpy)
    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Thursday, February 28, 2013 4:55 AM
  • Thank you Damian, you were right.

    I am able to get the Location field changed for both Sender as well as the receiver. Receiver will have the changed location with the Property Accessor property of the MeetingItem object and sender has it with the AssociatedAppointment of the Meeting item object.

    • Marked as answer by HeadBreaking Thursday, February 28, 2013 2:16 PM
    Thursday, February 28, 2013 2:16 PM