2 回答
TA贡献1725条经验 获得超7个赞
DistinguishedFolderId 不适用于非默认文件夹,因此我建议您尝试
'ParentFolderIds': {
'FolderId': {
'attributes': {
'Id': '<Some Custom Folder>'
}
}
}
TA贡献1816条经验 获得超6个赞
我让它工作的方法是首先找到FolderId使用FindFolder调用的方法:
const ewsArgs = {
FolderShape: {
BaseShape: 'AllProperties',
},
ParentFolderIds: {
DistinguishedFolderId: {
attributes: {
Id: 'inbox',
},
Mailbox: {
EmailAddress: 'emailaddress@company.com',
},
},
},
};
const { ResponseMessages } = await ews.run('FindFolder', ewsArgs, ews.ewsSoapHeader);
const found = ResponseMessages.FindFolderResponseMessage.RootFolder.Folders.Folder
.find(f => f.DisplayName.match(new RegExp(folderName.toLowerCase(), 'ig')));
之后,您可以使用它来查找文件夹中包含以下呼叫的所有电子邮件FindItem:
const ewsArgs = {
attributes: {
Traversal: 'Shallow',
},
ItemShape: {
BaseShape: 'IdOnly',
// BaseShape: 'AllProperties',
},
ParentFolderIds: {
FolderId: found.FolderId,
},
};
const { ResponseMessages } = await ews.run('FindItem', ewsArgs, ews.ewsSoapHeader);
添加回答
举报