Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
Hello All,

I am using EWS Managed API in my C# Application, while creating meeting request using Exchange Web Server 2013(EWS Managed API) the location(room) which I select is not getting booked by default as we do it from normal outlook, also if the meeting is less than one hour then it shows same start and end time, also is there any option to send the reply to other than organizer below is code which I am using for the same, can any body tell us which changes I need to do for this?
Thanks in Advance.!

C#
public string CreateMeetingRequest(DateTime startDate, DateTime endDate, string subject, string summary, string location, string[] optionalAttendies, string[] attendeeList)

        {
         string   meetingId = null;
       ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);                

                 service.UseDefaultCredentials = true;

                 service.AutodiscoverUrl(AutodiscoverURL, RedirectionUrlValidationCallback);

         Appointment appointment = new Appointment(service);      

         TimeSpan difference = endDate - startDate;

         int hours = (int)difference.Hours;

         double minutus = (double)difference.Minutes;

                 appointment.Subject = subject;

                 appointment.Body = summary;

                 appointment.StartTimeZone = TimeZoneInfo.Local;

                 appointment.EndTimeZone = TimeZoneInfo.Local;

                 appointment.Start = startDate;        

if (hours != 0)

                     appointment.End = appointment.Start.AddHours(hours);          

else

                     appointment.End = appointment.Start.AddMinutes(minutus);                

                     appointment.Resources.Add(location);

DayOfTheWeek[] days = new DayOfTheWeek[] { DayOfTheWeek.Weekday };

                 appointment.Recurrence = new Recurrence.WeeklyPattern(appointment.Start.Date, 1, days);

                 appointment.Recurrence.StartDate = appointment.Start.Date;

                 appointment.Recurrence.NumberOfOccurrences = 5;

                 appointment.Recurrence.EndDate = endDate;

                 appointment.IsReminderSet = true;

                 appointment.ReminderMinutesBeforeStart = 15;  

if (attendeeList != null)

                 {

if (attendeeList.Length > 0)

                     {

for (int i = 0; i < attendeeList.Length; i++)

                         {

                             appointment.RequiredAttendees.Add(attendeeList[i].ToString());

                         }

                     }

                 }

if (optionalAttendies != null)

                 {

if (optionalAttendies.Length > 0)

                     {

for (int j = 0; j < optionalAttendies.Length; j++)

                         {

                             appointment.OptionalAttendees.Add(optionalAttendies[j].ToString());

                         }

                     }        

                   }                                                  

                 appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
                 meetingId = appointment.Id.ToString();
                 return meetingId;

       }
Posted
Updated 13-Jan-14 20:06pm
v4
Comments
Maciej Los 10-Jan-14 16:51pm    
On the first look you should get compilation error, because Public string CreateMeetingRequest function does not contains return keyword. Secondly, C# language is case sensitive, which means Private and private does not means the same ;)
why c# is case sensitive?[^]
VivekMete 14-Jan-14 1:56am    
Hello Maciej,
Thanks for the response. you right this method needs return keyword and this is there, but I have removed it from this code because, issue is not related to return keywords, it returns meeting Id and generated a meeting request properly, but the location room is not booked, could you please help me on this, I have added the return keyword code here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900