如何使用ews-javascript-api获取参加EWS会议的电子邮件列表?

时间:2018-03-22 07:23:36

标签: node.js exchangewebservices ews-javascript-api

如何让所有参与今天与EWS会面的人(电子邮件)?

所以,让我们说我们有这样的意见:

  1. MS Exchange帐户的电子邮件/密码
  2. 时限:1天
  3. 会议:会议的ID或名称
  4. 我们如何获得此输出? 1.加入该会议的电子邮件列表

    谢谢。

1 个答案:

答案 0 :(得分:1)

试试这个。您只能获取与会者信息以及他们是否回复。你找不到谁参加了会议,只有那些打算根据公认的回应加入会议的人。

import { ExchangeService, Uri, WebCredentials, ExchangeVersion, EwsLogging, WellKnownFolderName, CalendarView, DateTime, PropertySet, BasePropertySet, MailboxType, MeetingResponseType } from "ews-javascript-api";


let credentials = require("./credentials");

EwsLogging.DebugLogEnabled = false;
var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials(credentials.userName, credentials.password);
service.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx");

new CalendarView(DateTime.Now, DateTime.Now.AddDays(3)));    

service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(DateTime.Now, DateTime.Now.AddDays(3))).then(res => {

    if (res.TotalCount > 0) {
        let calItem = res.Items[0];
        calItem.Load(new PropertySet(BasePropertySet.FirstClassProperties)).then(() => {
            // Appointment.Bind(service, new ItemId(itemId), new PropertySet(BasePropertySet.FirstClassProperties)).then(calItem => {

            console.log(calItem.Start.toString());
            console.log(calItem.End.toString());
            console.log(calItem.Subject);
            console.log(calItem.Id.UniqueId);

            // console.log(calItem.RequiredAttendees);

            calItem.RequiredAttendees.GetEnumerator().forEach(x => {
                console.log(x.Name + "    -     " + x.Address + "     -      " + MailboxType[x.MailboxType] + "      -     " + MeetingResponseType[x.ResponseType] + "     -      " + (x.LastResponseTime ? x.LastResponseTime.toString() : null));
            });
            calItem.OptionalAttendees.GetEnumerator().forEach(x => {
            console.log(x.Name + "    -     " + x.Address + "     -      " + MailboxType[x.MailboxType] + "      -     " + MeetingResponseType[x.ResponseType] + "     -      " + (x.LastResponseTime ? x.LastResponseTime.toString() : null));
        });
        }, err => {
            debugger;
            EwsLogging.DebugLog(err, true);
        });
    }
}, err => {
    debugger;
    EwsLogging.DebugLog(err, true);
});