none
Send vs SubmitMessage RRS feed

  • Question

  • I am trying to implement AppointmentItem->Send() from the outlook object model on extended mapi to avoid the security warning. When using IMessage->SubmitMessage() it sends correctly but moves the calendar event out of the folder.  If there is another way that would work too but I'm already using extended mapi to add recipients so I figured sending the invite could be done with that too.

    Wednesday, January 14, 2015 11:23 PM

Answers

All replies

  • When you call AppointmentItem.Send, Outlook creates a meeting request (MeetingItem) and sends it. The original appointment is updated to reflect the fact that the invitation/update is sent, but otherwise it is left intact.

    Take a look at an existing meeting request in the Sent Items with OutlookSpy (click IMessage button) and compare it with the appointment item in the Calendar folder (you can use the IMessage | Compare tab).


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

    Thursday, January 15, 2015 2:14 AM
  • Thanks I will start there.  Is there an easy way to create the MeetingItem using the AppointmentItem somehow?  Such as copying the record and changing the type vs adding it all from scratch?
    Thursday, January 15, 2015 4:11 PM
  • Hello Andy,

    The MeetingStatus property is used to specify the meeting status of the appointment. For example:

    Sub CreateAppt()  
     Dim myItem As Object  
     Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient 
     Set myItem = Application.CreateItem(olAppointmentItem)  
     myItem.MeetingStatus = olMeeting  
     myItem.Subject = "Strategy Meeting"  
     myItem.Location = "Conference Room B"  
     myItem.Start = #9/24/2015 1:30:00 PM#  
     myItem.Duration = 90  
     Set myRequiredAttendee = myItem.Recipients.Add("Nate Sun")  
     myRequiredAttendee.Type = olRequired  
     Set myOptionalAttendee = myItem.Recipients.Add("Kevin Kennedy")  
     myOptionalAttendee.Type = olOptional  
     Set myResourceAttendee = myItem.Recipients.Add("Conference Room B")  
     myResourceAttendee.Type = olResource  
     myItem.Display  
    End Sub

    Thursday, January 15, 2015 5:52 PM
  • No, MeetingItems is either received or created by AppointmentItem.Send.

    If you are using Extended MAPI, IMAPIFolder::CreateMessage() must be used to create the new message. It is then your responsibility to set PR_MESSAGE_CLASS and other properties to make it a valid meeting request / update - take a look at an existing meeting request in your Sent Items folder with OutlookSpy (click IMessage button).


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

    Thursday, January 15, 2015 6:50 PM
  • What folder should the MeetingItem be created in? I have this partially working by using .Copy to create a copy of the AppointmentItem then using Extended MAPI to change the message class and some other fields.  This works if I wait for the invites to be sent and do nothing else.

    - Iterating through records in the Calendar folder causes the MeetingItem to never send if I run that code before outlook send/receive completes

    - Using .Move on the MeetingItem creates a copy of it in the Drafts folder instead of the folder I specified such as outbox.

    Monday, January 19, 2015 10:23 PM
  • Any folder. Outbox is just an eye candy - a message can be submitted from nay folder.

    What is important is that you never touch the meeting request after calling SumitMessage.


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

    Monday, January 19, 2015 10:39 PM
  • That's good to know, so I guess my problem is this. How do I run something like IMAPITable::QueryRows without touching those meeting requests?  It would also work if I could force the message to be sent but I'm not sure that is possible given OL could be offline and I would still need to run QueryRows shortly after.
    Tuesday, January 20, 2015 4:05 PM
  • Why exactly do you need QueryRows?

    What information are you retrieving after sending the meeting request?


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

    Tuesday, January 20, 2015 5:37 PM
  • This is for syncing outlook data to some other destination. 1 Process adds data to OL including possible meeting invites and sends them. The other reads outlook data, I don't need to read the meeting requests, only other appointment items in the calendar folder to see if anything has been changed.
    Tuesday, January 20, 2015 8:05 PM
  • Reading the appointments is perfectly fine. It is only accessing the IMessage that just had IMessage::SubmitMessage called is a problem.

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

    Tuesday, January 20, 2015 8:37 PM
  • Thanks I think I have it working now. I was getting the categories using the object model which cause submit to fail, if I check the message class first then ignore it works fine.
    Tuesday, January 20, 2015 11:40 PM
  • A follow up for this issue.  Is there a way to do this with iCloud folders?  It looks like both Send() and SubmitMessage() fail for calendar events in an iCloud folder and recipients are done differently too.
    Wednesday, March 4, 2015 7:51 PM
  • What is the error message? Are you submitting an appointment or a meeting item?

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

    Wednesday, March 4, 2015 9:19 PM
  • What is the error message? Are you submitting an appointment or a meeting item?

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

    It looks like just an appointment, its not even letting me change the message class.  I'm using the same code that works on non-icloud folders.  Send() returns false and SubmitMessage() returns not implemented.  Have you tried anything with iCloud folders before?  It seems like there are some big differences.

    Thursday, March 5, 2015 5:16 PM
  • As I mentioned before, IPM.Appoinment item cannot be sent. You need to create a new item (meeting request), populate its properties and send it. The original appointment must be left intact in the Calendar folder.

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

    Thursday, March 5, 2015 6:29 PM
  • I am having 1 more problem with this (not related to iCloud).  There seems to be an arbitrary delay between submitting the message and when it actually sends.  Until then the Appointment and Meeting request are both side by side in the calendar and appear as a duplicate to a user who looks at their calendar.
    Friday, March 20, 2015 3:35 PM
  • Are you creating meeting request in the Calendar folder? Create it in the Outbox instead.

    BTW, if a post answers your question, please mark it as such.


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

    • Marked as answer by andycsuc Wednesday, March 25, 2015 7:01 PM
    Friday, March 20, 2015 6:27 PM