locked
meetingrequest help RRS feed

  • Question

  • hi:

    i am trying to write codes about sending a meeting request email by EWS manager code(version:beta 1.0).

    but i found i cannt create a meetingrequest instance .the only way to create a meetingrequest is using MeetingRequest.Bind function.

    but where's my itemid?

    string itemId = Guid.NewGuid().ToString();

    MeetingRequest obj = MeetingRequest.Bind(service, new ItemId(itemId);


    can any body help me ?

    thanks.

    david.


    aaa
    Friday, June 12, 2009 5:50 AM

Answers

  • The Creating Appointments and Meetings topic in the EWS Managed API 1.0 Beta SDK contains a section that explains how to "create a meeting and send a meeting request to invitees."  Here's a code example (C#) from that topic that creates a meeting on the organizer's (sender's) calendar, and sends a meeting request message to each of the three attendees. 
    :

    // Create the appointment.
    Appointment appointment = new Appointment(service);
    
    // Set properties on the appointment. Add two required attendees and one optional attendee.
    appointment.Subject = "Status Meeting";
    appointment.Body = "The purpose of this meeting is to discuss status.";
    appointment.Start = new DateTime(2009, 3, 1, 9, 0, 0);
    appointment.End = appointment.Start.AddHours(2);
    appointment.Location = "Conf Room";
    appointment.RequiredAttendees.Add("user1@contoso.com");
    appointment.RequiredAttendees.Add("user2@contoso.com");
    appointment.OptionalAttendees.Add("user3@contoso.com");
    
    // Send the meeting request to all attendees and save a copy in the Sent Items folder.
    appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
    If I execute this code sample, and then connect to EWS using the credentials of user2@contoso.com (one of the attendees), I can iterate through the items in user2's Inbox using the following code:

    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
    foreach (Item item in findResults.Items)
    {
        if (item is EmailMessage)
        {
            EmailMessage em = EmailMessage.Bind(service, new ItemId(item.Id.UniqueId));
            Console.WriteLine("------------------");
            Console.WriteLine("ID = " + item.Id.UniqueId);
            Console.WriteLine("Subject = " + item.Subject);
            Console.WriteLine("From = " + em.From.Address);
            Console.WriteLine("ItemClass = " + em.ItemClass);
            Console.WriteLine("------------------");
            Console.WriteLine("");
        }
    }
    As expected, one of the items found in user2's Inbox is the meeting request message, and this message has item class = "IPM.Schedule.Meeting.Request" as shown in the following (abbreviated) XML Response:

    <m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:GetItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:MeetingRequest>
              <t:ItemId Id="ABCDE..." ChangeKey="AQAAAA=="  />
              <t:ParentFolderId Id="ABCDE..." ChangeKey="AQAAAA==" />
              <t:ItemClass>IPM.Schedule.Meeting.Request</t:ItemClass>
              <t:Subject>Status Meeting</t:Subject>
              ...other elements omitted...
            </t:MeetingRequest>
          </m:Items>
        </m:GetItemResponseMessage>
      </m:ResponseMessages>
    </m:GetItemResponse>
    Regards,
    Kim
    Programming Writer, Microsoft Exchange Developer Documentation Team
    • Edited by Kim Brandl Friday, June 12, 2009 9:40 PM
    • Marked as answer by Kim Brandl Friday, June 12, 2009 9:43 PM
    Friday, June 12, 2009 9:22 PM

All replies

  • Hi,

    that's not the way meetingrquests work. You need to create a meeting in your calendar and add attendees (required attendees, optional attendees and resources) to it. And when you save the meeting, you can specify that you want Exchnage to send meeting requests.

    Kind regards,
    Henning
    Friday, June 12, 2009 7:31 AM
  • hi,Henning:

    i am very clear what you said.

    the question is how i create a meeting. could you please give me a demo,or take a look my codes.

      public static void SendAppoiment(ExchangeService service)
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                               (sender, certificate, chain, sslPolicyErrors) => true;
    
                var appointment = new Appointment(service);
                appointment.Subject = "Meditation-999-10-110";
                appointment.Body = "My weekly relaxation time.";
                appointment.Start = new DateTime(2009, 6, 25, 18, 0, 0);
                appointment.End = appointment.Start.AddHours(2); 
                appointment.RequiredAttendees.Add(new Attendee("js.daiwei@gmail.com"));
                //appointment.ItemClass = "IPM.Schedule.Meeting.Request";
                try
                {
                    appointment.Save(WellKnownFolderName.Calendar, SendInvitationsMode.SendToAllAndSaveCopy);
                    Console.WriteLine("ok");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("error," + ex.Message);
                }
                Console.ReadLine();
    
            }
    the email's itemclass is "IPM.SchedulePlus.FreeBusy.BinaryData" instead of "IPM.Schedule.Meeting.Request".

    thanks for your answer.

    david.
    aaa
    Friday, June 12, 2009 8:54 AM
  • could anybody help me about this subject?
    aaa
    Friday, June 12, 2009 11:30 AM
  • The Creating Appointments and Meetings topic in the EWS Managed API 1.0 Beta SDK contains a section that explains how to "create a meeting and send a meeting request to invitees."  Here's a code example (C#) from that topic that creates a meeting on the organizer's (sender's) calendar, and sends a meeting request message to each of the three attendees. 
    :

    // Create the appointment.
    Appointment appointment = new Appointment(service);
    
    // Set properties on the appointment. Add two required attendees and one optional attendee.
    appointment.Subject = "Status Meeting";
    appointment.Body = "The purpose of this meeting is to discuss status.";
    appointment.Start = new DateTime(2009, 3, 1, 9, 0, 0);
    appointment.End = appointment.Start.AddHours(2);
    appointment.Location = "Conf Room";
    appointment.RequiredAttendees.Add("user1@contoso.com");
    appointment.RequiredAttendees.Add("user2@contoso.com");
    appointment.OptionalAttendees.Add("user3@contoso.com");
    
    // Send the meeting request to all attendees and save a copy in the Sent Items folder.
    appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
    If I execute this code sample, and then connect to EWS using the credentials of user2@contoso.com (one of the attendees), I can iterate through the items in user2's Inbox using the following code:

    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
    foreach (Item item in findResults.Items)
    {
        if (item is EmailMessage)
        {
            EmailMessage em = EmailMessage.Bind(service, new ItemId(item.Id.UniqueId));
            Console.WriteLine("------------------");
            Console.WriteLine("ID = " + item.Id.UniqueId);
            Console.WriteLine("Subject = " + item.Subject);
            Console.WriteLine("From = " + em.From.Address);
            Console.WriteLine("ItemClass = " + em.ItemClass);
            Console.WriteLine("------------------");
            Console.WriteLine("");
        }
    }
    As expected, one of the items found in user2's Inbox is the meeting request message, and this message has item class = "IPM.Schedule.Meeting.Request" as shown in the following (abbreviated) XML Response:

    <m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:GetItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:MeetingRequest>
              <t:ItemId Id="ABCDE..." ChangeKey="AQAAAA=="  />
              <t:ParentFolderId Id="ABCDE..." ChangeKey="AQAAAA==" />
              <t:ItemClass>IPM.Schedule.Meeting.Request</t:ItemClass>
              <t:Subject>Status Meeting</t:Subject>
              ...other elements omitted...
            </t:MeetingRequest>
          </m:Items>
        </m:GetItemResponseMessage>
      </m:ResponseMessages>
    </m:GetItemResponse>
    Regards,
    Kim
    Programming Writer, Microsoft Exchange Developer Documentation Team
    • Edited by Kim Brandl Friday, June 12, 2009 9:40 PM
    • Marked as answer by Kim Brandl Friday, June 12, 2009 9:43 PM
    Friday, June 12, 2009 9:22 PM
  • hi all:

    i am so sorry to trouble you guys again.

    by the below codes.i can send a appointment now. the mailbox used to send the appointment is d@s.

    i sent an appointment to p@s. and p@s can get the mail. p@s replied and agreed the appoiment(the appointment is in p@s calender).


    when i used the outlook 2007 to get in d@s inbox,and open the replied appointment.

    outlook2007 gives that is "this meeting is not in the calendar ;it may have been deleted or removed...".

    what i want is set the appointment to d@s's calender just like p@s.


    could any body help me again?

    thanks.

    public static Appointment CreateAppoinment()
            {
                var service = CreateExchangeService();
                var appointment = new Appointment(service);
                appointment.Subject = "Status Meeting";
                appointment.Body = "The purpose of this meeting is to discuss status";
                appointment.Start = new DateTime(2009, 6, 15, 17, 0, 0);
                appointment.End = appointment.Start.AddHours(2);
                appointment.Location = "Conf Room";
                appointment.RequiredAttendees.Add("p@s");
                appointment.OptionalAttendees.Add("shi@s");
    
                appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
                return appointment;
    
    
    
    
                return null;
            }

    aaa
    Monday, June 15, 2009 8:25 AM