How to get email body for an appointment from outlook exchange server ? RRS feed

  • Question

  • I am trying to fetch email body from exchange server for an appointment for a particular room but did not get a success. Verified all the blogs over internet but nothing was of any help. Here is the code where  i am trying to contact exchange server to get the details:

    Approach A


    service.GetUserAvailability(attendees,new TimeWindow(twStart, twEnd),AvailabilityData.FreeBusy
                                                                                       ). AttendeesAvailability[0].CalendarEvents;

    Approach B


    public class MailItem
                public string From;
                public string[] Recipients;
                public string Subject;
                public string Body;
    public static MailItem[] GetUnreadMailFromInbox(ExchangeService service, string address)

    // Address is the email address for an meeting room

                    service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, address);
                    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(128));
                    ServiceResponseCollection<GetItemResponse> items =
                        service.BindToItems(findResults.Select(item => item.Id), new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.From, EmailMessageSchema.ToRecipients));

                    FindItemsResults<Item> findResults2 = service.FindItems(WellKnownFolderName.Calendar, new ItemView(128));
                    ServiceResponseCollection<GetItemResponse> items2 =
                        service.BindToItems(findResults2.Select(item2 => item2.Id), new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.From, EmailMessageSchema.ToRecipients));
                    return items.Select(item =>
                        return new MailItem()
                            From = address,
                            Recipients = ((Microsoft.Exchange.WebServices.Data.EmailAddressCollection)item.Item[EmailMessageSchema.ToRecipients]).Select(recipient => recipient.Address).ToArray(),
                            Subject = item.Item.Subject,
                            Body = item.Item.Body.ToString(),
                catch (Exception ex)
                    throw ex;

    I need a solution for fetching the body content for appointments from exchange server.

    Thursday, October 6, 2016 4:42 PM