ews-javascript-api icon indicating copy to clipboard operation
ews-javascript-api copied to clipboard

Get Appointment Organizer and Attendee

Open PeterArcurve opened this issue 3 years ago • 3 comments
trafficstars

FindAppointments can be used to get appointments which contains an Organizer and RequiredAttendees.

Organizer has EmailAddress but the object doesn't contain anything that resembles an email address. Instead it has something like this address = "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=CE11C450489142DEBA5DBFD9D07C8105-JEROS SHARE/"

RequiredAttendess is always coming back empty even though Outlook indicates there are several required attendees.

How do get the organizer and requiredAttendee email addresses?

PeterArcurve avatar Dec 03 '21 03:12 PeterArcurve

FindAppointments does not bring down all the properties of item, This is due to nature of search request and controlled by server side of ews.

to get more properties or even load full email address, you want to either use appointmentItem.Load(new propertySet(....)) or Appointment.Bind(....) or ewsService.LoadPropertiesForItems(...)

gautamsi avatar Dec 03 '21 05:12 gautamsi

FindAppointments does not bring down all the properties of item, This is due to nature of search request and controlled by server side of ews.

to get more properties or even load full email address, you want to either use appointmentItem.Load(new propertySet(....)) or Appointment.Bind(....) or ewsService.LoadPropertiesForItems(...)

how to use Appointment.Bind(....) such api to get appointment.RequiredAttendees

exch.ImpersonatedUserId = new ews.ImpersonatedUserId(ews.ConnectingIdType.SmtpAddress, [email protected]');
var view = new ews.CalendarView(ews.DateTime.Now.Add(-1, "week"), ews.DateTime.Now.Add(1, 'week'));
exch.FindAppointments(ews.WellKnownFolderName.Calendar, view).then(response => {
    let appointments = response.Items;
    for (let appointment of appointments) {
        // console.log(appointment)
        ews.Appointment.Bind(exch, new ews.ItemId(appointment.Id.UniqueId),
                                               new ews.PropertySet(ews.AppointmentSchema.Subject,
                                               ews.AppointmentSchema.Location, 
                                               ews.AppointmentSchema.RequiredAttendees, 
                                               ews.AppointmentSchema.Start,
                                               ews.AppointmentSchema.End, 
                                               ews.AppointmentSchema.Organizer)).then(() => {
                                                                    console.log('Organizer:', appointment.Organizer.name)
                                                                    console.log("Subject: ", appointment.Subject);
                                                                     console.log("Location: ", appointment.Location);
                                                                     let start = appointment.Start.Format('YYYY-MM-DD HH:mm:ss')

                                                                     let end = appointment.End.Format('YYYY-MM-DD HH:mm:ss')

                                                                     console.log("Start: ", start);

                                                                      console.log("End: ", end);
                                                                      appointment.RequiredAttendees.Items.forEach((a) => {
                                                                                 console.log(a.Address);
                                                                       });
                                                  })


    }

}).catch(err => {
    console.log('err:', err)
})   

roy2651 avatar May 18 '22 09:05 roy2651

FindAppointments does not bring down all the properties of item, This is due to nature of search request and controlled by server side of ews. to get more properties or even load full email address, you want to either use appointmentItem.Load(new propertySet(....)) or Appointment.Bind(....) or ewsService.LoadPropertiesForItems(...)

how to use Appointment.Bind(....) such api to get appointment.RequiredAttendees

exch.ImpersonatedUserId = new ews.ImpersonatedUserId(ews.ConnectingIdType.SmtpAddress, [email protected]');
var view = new ews.CalendarView(ews.DateTime.Now.Add(-1, "week"), ews.DateTime.Now.Add(1, 'week'));
exch.FindAppointments(ews.WellKnownFolderName.Calendar, view).then(response => {
    let appointments = response.Items;
    for (let appointment of appointments) {
        // console.log(appointment)
        ews.Appointment.Bind(exch, new ews.ItemId(appointment.Id.UniqueId),
                                               new ews.PropertySet(ews.AppointmentSchema.Subject,
                                               ews.AppointmentSchema.Location, 
                                               ews.AppointmentSchema.RequiredAttendees, 
                                               ews.AppointmentSchema.Start,
                                               ews.AppointmentSchema.End, 
                                               ews.AppointmentSchema.Organizer)).then(() => {
                                                                    console.log('Organizer:', appointment.Organizer.name)
                                                                    console.log("Subject: ", appointment.Subject);
                                                                     console.log("Location: ", appointment.Location);
                                                                     let start = appointment.Start.Format('YYYY-MM-DD HH:mm:ss')

                                                                     let end = appointment.End.Format('YYYY-MM-DD HH:mm:ss')

                                                                     console.log("Start: ", start);

                                                                      console.log("End: ", end);
                                                                      appointment.RequiredAttendees.Items.forEach((a) => {
                                                                                 console.log(a.Address);
                                                                       });
                                                  })


    }

}).catch(err => {
    console.log('err:', err)
})   

done

roy2651 avatar May 20 '22 09:05 roy2651