有没有办法使用EWS托管api (NodeJs实现)从MS-Exchange中的自定义文件夹中读取电子邮件?我可以从收件箱中读取,但我有自定义的文件夹名称,我希望在这些文件夹中读取代码。
我试过的东西。
const EWS = require('node-ews');
const ewsConfig = {
username: '<Email>',
password: '<Password>',
host: '<Exchange URL>'
};
const ews = new EWS(ewsConfig);
const ewsFunction = 'FindItem';
var ewsArgs = {
'attributes': {
'Traversal': 'Shallow'
},
'ItemShape': {
't:BaseShape': 'IdOnly',
't:AdditionalProperties': {
't:FieldURI': {
'attributes': {
'FieldURI': 'item:Subject'
}
}
}
},
'ParentFolderIds': {
'DistinguishedFolderId': {
'attributes': {
'Id': '<Some Custom Folder>'
}
}
}
};
(async function () {
try {
let result = await ews.run(ewsFunction, ewsArgs);
console.log(result);
} catch (err) {
console.log(err.message);
}
})();
错误:
a:ErrorInvalidRequest: The request is invalid.: {"ResponseCode":"ErrorInvalidRequest","Message":"The request is invalid."}
发布于 2020-10-15 06:56:55
DistinguishedFolderId不适用于非默认文件夹,因此我建议您尝试
'ParentFolderIds': {
'FolderId': {
'attributes': {
'Id': '<Some Custom Folder>'
}
}
}
https://stackoverflow.com/questions/64346372
复制相似问题