-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathroomlists.js
More file actions
31 lines (27 loc) · 1.14 KB
/
roomlists.js
File metadata and controls
31 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module.exports = function (callback) {
// modules -------------------------------------------------------------------
var ews = require("ews-javascript-api");
var auth = require("../../config/auth/auth.js");
//if NTLM
require('dotenv').config()
//console.log(".env = " + process.env.REACT_APP_EnableNTLM);
if (process.env.REACT_APP_EnableNTLM=="true") {
var ewsNTLM = require("ews-javascript-api-auth");
ews.ConfigurationApi.ConfigureXHR(new ewsNTLM.ntlmAuthXhrApi(auth.exchange.username, auth.exchange.password, true));
}
//
// ews -----------------------------------------------------------------------
const exch = new ews.ExchangeService(ews.ExchangeVersion.Exchange2013);
exch.Credentials = new ews.WebCredentials(auth.exchange.username, auth.exchange.password);
exch.Url = new ews.Uri(auth.exchange.uri);
// get roomlists from EWS and return sorted array of room list names
exch.GetRoomLists().then((lists) => {
var roomLists = [];
lists.items.forEach(function (item, i, array) {
roomLists.push(item.Name);
});
callback(null, roomLists.sort());
}, (err) => {
callback(err, null);
});
};