2 回答

TA貢獻1725條經驗 獲得超8個贊
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: '[email protected]',
},
},
},
};
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);
添加回答
舉報