none
Recipients don't recieve invitation

    Question

  • Hi

    I'm adding recipients to an appointment by their email address in my c# application.  If the user is a recipient the meeting shows up on their calendar.  I'm also able to get the meeting into a public folder.  But for email addresses other than the user's, the recipients do not get their invitation unless the user clicks on the "Invite recipients" button in Outlook.  I've tried using recipients.ResolveAll() but the same thing happens. 

    Thanks in advance!


    Steve Schlipf

    Friday, December 13, 2013 4:05 PM

Answers

  • Hello Steve,

    Thank you for publishing your code here.

    It looks like need to set the MeetingStatus property of the AppointmentItem class to the olMeeting value:

    myItem.MeetingStatus = Outlook.OlMeetingStatus.olMeeting; 
    
    Is it what you are looking for?
    • Marked as answer by Steve Schlipf Saturday, December 21, 2013 7:40 PM
    Saturday, December 21, 2013 12:05 PM

All replies

  • Have you tried to call AppointmentItem.Send?

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

    Friday, December 13, 2013 5:01 PM
  • Hi Dmitry, thanks for your response.  I use appointment.Display((object)true) so that the user can modify the automated subject, body and anything else before sending it.  When the user hits send before hitting "Invite recipients" the error occurs.

    Steve Schlipf

    Friday, December 13, 2013 5:13 PM
  • Are you actually getting an error? What is it? Or is it just the attendees do not receive invitations?

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

    Friday, December 13, 2013 5:22 PM
  • There is no error thrown.  They just never get an invitation. 

    If Michael clicks the button in my app to send an invitation to himself, the app fills in Michael's email address and shows the invitation in Outlook.  Michael clicks Send and he gets the invite. 

    If Dave clicks the button in my app to send an invitation to Michael, the app fills in Michael's email address and shows the invitation in Outlook.  Dave clicks Send but Michael does not get the invite.  But if Dave clicks the "Invite attendees button" before clicking send (without touching the list of attendees) then Michael gets the invitation.


    Steve Schlipf

    Friday, December 13, 2013 5:46 PM
  • Hello Steve,

    Please make sure that you call the ResolveAll method against the Recipients collection and all the recipients are resolved after. For example:

    Sub CheckRecipients()  
     Dim myItem As Outlook.AppointmentItem  
     Dim myRecipients As Outlook.Recipients  
     Dim myRecipient As Outlook.Recipient 
     
     Set myItem = Application.CreateItem(olAppointmentItem)  
     Set myRecipients = myItem.Recipients  
     myRecipients.Add("Aaron Con")  
     myRecipients.Add("Nate Sun")  
     myRecipients.Add("Dan Wilson")  
     If Not myRecipients.ResolveAll Then  
       For Each myRecipient In myRecipients  
         If Not myRecipient.Resolved Then 
            MsgBox myRecipient.Name 
         End If 
       Next 
     End If  
    End Sub
    
    Then you need to call the Send method of the AppointmentItem for sending appointments to attendees.
    Friday, December 13, 2013 8:45 PM
  • Thanks for your response.  When I check the recipients they are all resolved.  I added Send on the appointment item before displaying it.  But the invitations don't get sent if I don't open the appointment in Outlook, go to the Invite Attendees and hit Send. 

    Here's what my code looks like.  All of the objects are happy when I'm in the debugger.  The appointment pops up, I tell it to save and close.  I look in my sent items and it isn't there.  It is, however, on my calendar.  If I open it from the calendar and click on Invite Attendees there's a message at the top that invitations have not been sent.  If I hit send the invitations go out and it lands in my sent items (and on the recipients' calendars).

    var outlookApp = new OL.Application();  // using OL = Microsoft.Office.Interop.Outlook;
    var objNS = outlookApp.GetNamespace("MAPI");
    var folders = objNS.Folders;
    OL.Folder folder = (OL.Folder)objNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
    var oAppointment = (OL.AppointmentItem)folder.Items.Add(OL.OlItemType.olAppointmentItem);
    oAppointment.Recipients.Add("me@myEmailDomain.com");
    oAppointment.Recipients.ResolveAll();

    foreach (OL.Recipient r in oAppointment.Recipients)
    {
     if (!r.Resolved)
     {
      MessageBox.Show(r.Name);
     }
    }

    oAppointment.Save();
    ((OL._AppointmentItem)oAppointment).Send();  // If I just use oAppointment.Send() the compiler complains about an ambiguity
    oAppointment.Display((object)true);


    Steve Schlipf

    Thursday, December 19, 2013 6:35 PM
  • Hello Steve,

    Thank you for publishing your code here.

    It looks like need to set the MeetingStatus property of the AppointmentItem class to the olMeeting value:

    myItem.MeetingStatus = Outlook.OlMeetingStatus.olMeeting; 
    
    Is it what you are looking for?
    • Marked as answer by Steve Schlipf Saturday, December 21, 2013 7:40 PM
    Saturday, December 21, 2013 12:05 PM
  • I do believe you nailed it!  Thank you Eugene!!!

    Steve Schlipf

    Saturday, December 21, 2013 7:41 PM