You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am able to send email using this package but I am not able find suitable example to read email from Inbox folder and get the body and attachments from the email.
You can use following code to get emails from Inbox using FindItem function and then read each email using GetItem function 👍 // Read emails from Inbox
var ewsFunction = 'FindItem';
var ewsArgs = {
'attributes': {
'Traversal': 'Shallow'
},
'ItemShape': {
't:BaseShape': 'IdOnly',
't:AdditionalProperties': {
't:FieldURI': {
'attributes': {
'FieldURI': 'item:Subject'
}
}
}
},
'ParentFolderIds' : {
'DistinguishedFolderId': {
'attributes': {
'Id': 'inbox'
}
}
}
};
// Itreate over all the emails and store Id and ChangeKey.
ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
.then(result => {
// Iterate over the result and extract Id and ChangeKey of the messages and pass those to GetItem function to read messages
})
// For reading individual messages returned by FindItem (using Id and ChangeKey)
var ewsFunction = 'GetItem';
var ewsArgs = {
'ItemShape': {
'BaseShape': 'Default',
't:AdditionalProperties': {
't:FieldURI': {
'attributes': {
'FieldURI': 'item:Attachments'
}
}
}
},
'ItemIds' : {
'ItemId': {
'attributes': {
'Id': Id,
'ChangeKey' : ChangeKey
}
}
}
};
await ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
.then(result => {
// Iterate over the result and extract meesage
})
Hi,
I am able to send email using this package but I am not able find suitable example to read email from Inbox folder and get the body and attachments from the email.
I have gone through the Microsoft docs e.g. https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-work-with-exchange-mailbox-items-by-using-ews-in-exchange#get-an-item-by-using-the-ews-managed-api
but the examples are provided in C#, C++ or VB..
But I want to do this with Nodejs.
The text was updated successfully, but these errors were encountered: