none
how to create Meeting request using Exchange webservice 2007 RRS feed

  • Question

  • Hi,

    I Have create a exchange server 2007 and trying to use the web service of exchange server for creating meeting and sending Emails to the attendees and also wants to create Task in the Exchange show that I can Create Task and It will be automatic sync with the client outlook and any change made in the same Task on the clent application  e.g outlook It should reflect the same in the exchange and by using webservice wants to show the same on the portal page . By using asp.net with C#.

     Thaks

     

    Thursday, April 26, 2012 6:10 PM

All replies

  • Hi ,

    The bellow code is working fine but throws error while Attendees are added it throws

    CreateItem ResponseType error- System.InvalidOperationException of XML.

     // Create the service binding.
                ExchangeServiceBinding esb = new ExchangeServiceBinding();
                esb.Credentials = new NetworkCredential("test", "user@123", "abc");
                esb.Url = @"http://ass233/EWS/exchange.asmx";
                // Create the appointment.
                CalendarItemType appointment = new CalendarItemType();
                // Add item properties to the appointment.
                appointment.Body = new BodyType();
                appointment.Body.BodyType1 = BodyTypeType.HTML;
                appointment.Body.Value = "Agenda Items....";
                appointment.Categories = new string[] { "Category1", "Category2" };
                appointment.Importance = ImportanceChoicesType.High;
                appointment.ImportanceSpecified = true;
                appointment.ItemClass = "IPM.Appointment";
                appointment.Subject = "Dantal 247";
                // Add calendar properties to the appointment.
               // new DateTime(2008, 8, 14, 15, 30, 00);
                //appointment.Start = System.DateTime.Parse("2012-04-26T19:00:00Z");
                appointment.Start = new DateTime(2012, 4, 27, 16, 30, 00); 
                appointment.StartSpecified = true;
                appointment.End = new DateTime(2012, 4, 27, 17, 30, 00);
                appointment.EndSpecified = true;
                appointment.RequiredAttendees = new[] 
                        {
                           new AttendeeType
                           {
                                 Mailbox =new EmailAddressType
                                 {
                                    EmailAddress ="rnd@abc.com", RoutingType = "SMTP"
                                 }
                            },
                          new AttendeeType{Mailbox =new EmailAddressType
                                  {
                                     EmailAddress ="test@abc.com",RoutingType = "SMTP"}
                                   }
                        };
                // Identify the destination folder that will contain the appointment.
                DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
                folder.Id = DistinguishedFolderIdNameType.calendar;
                // Create the array of items that will contain the appointment.
                NonEmptyArrayOfAllItemsType arrayOfItems = new NonEmptyArrayOfAllItemsType();
                arrayOfItems.Items = new ItemType[1];
                // Add the appointment to the array of items.
                arrayOfItems.Items[0] = appointment;
                // Create the CreateItem request.
                CreateItemType createItemRequest = new CreateItemType();
                // The SendMeetingInvitations attribute is required for calendar items.
                createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy;
                createItemRequest.SendMeetingInvitationsSpecified = true;
                // Add the destination folder to the CreateItem request.
                createItemRequest.SavedItemFolderId = new TargetFolderIdType();
                createItemRequest.SavedItemFolderId.Item = folder;
                // Add the items to the CreateItem request.
                createItemRequest.Items = arrayOfItems;
                try
                {
                    // Send the request and get the response.
                    CreateItemResponseType createItemResponse = esb.CreateItem(createItemRequest);
                    // Get the response messages.
                    ResponseMessageType[] rmta = createItemResponse.ResponseMessages.Items;
                    foreach (ResponseMessageType rmt in rmta)
                    {
                        ArrayOfRealItemsType itemArray = ((ItemInfoResponseMessageType)rmt).Items;
                        ItemType[] items = itemArray.Items;
                        // Get the item identifier and change key for each item.
                        foreach (ItemType item in items)
                        {
                            Label1.Text= ("Item identifier: " + item.ItemId.Id);
                            Label1.Text+=("Item change key: " + item.ItemId.ChangeKey);
                        }
                    }
                }
                catch (Exception e)
                {
                    Label1.Text=("Error Message: " + e.Message);
                }

    Friday, April 27, 2012 6:51 AM
  • The code itself works okay so there is nothing wrong with that.

    with

    >>esb.Url = @"http://ass233/EWS/exchange.asmx";

    I would suggest you use https:// instead generally EWS wont listen on http unless its specifically configured and its not a good idea to use http anyway for a number of security reasons.

    Cheers
    Glen

    Saturday, April 28, 2012 1:01 AM
  • Hi

    I have another problem. As by sing Exchange API of Exchangeserver 2007sp_1

     ExchangeService esb = new ExchangeService();
                esb
    .Credentials = new NetworkCredential("test", "user@123", "abc");
                esb
    .Url = @http://ass233/EWS/exchange.asmx;
    I above we have to provide the network credendial and It is the user by which all the mails and Meetings are created but I want the meeting or the mail should be sent from the loged in user' email. But For this I mean for network credential it needs Password.

    Is other way to do the same OR Have to fetch the password from the AD

    In both the way I am not able to understand how it will be done please help Its Urgent.

    Thanks

    Monday, April 30, 2012 6:54 AM
  • If your using this from within ASP.net you can make use of Impersonation in IIS to reuse the current logged on credentials you need to make sure that if your running the code on a different server from the Exchange server that your IIS application pool account has kerberos delegation rights I'd suggest reading http://msdn.microsoft.com/en-us/library/ff647404.aspx

    The other option is to create a Service level account and grant that EWS Impersonation rights see http://blogs.msdn.com/b/exchangedev/archive/2009/06/15/exchange-impersonation-vs-delegate-access.aspx

    Cheers
    Glen

      
    Tuesday, May 1, 2012 4:39 AM