Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get attachment of .EML type #434

Open
german-st opened this issue Mar 11, 2024 · 1 comment
Open

Cannot get attachment of .EML type #434

german-st opened this issue Mar 11, 2024 · 1 comment

Comments

@german-st
Copy link

german-st commented Mar 11, 2024

Hello.

When reading emails with attachments in .EML format, we receive an error.
Sorry in advance we can't use typescript.
We use the version: 0.14.0
NodeJS version: v20.11.1

This comment does not work:

let items = await exch.FindItems(folderId, "isRead:false", view);
	for (var item of items.Items) {
        let res = await item.Load();
        let attachs = [];
	if (item.HasAttachments)
        {
		const exchangeAttachments = item.Attachments?.GetEnumerator() ?? [];
		  for await (const attachment of exchangeAttachments) {
				const attachments = await exch.GetAttachments([attachment.Id], "HTML", []); //there's an error here
				console.log('attachments', attachments);
				const itemAttachment = attachments.Responses[0].Attachment;
				await itemAttachment.Load();
				console.log('attach', itemAttachment);
		}
	}

and getting error:
image

If we try to simply download the attachment:

let items = await exch.FindItems(folderId, "isRead:false", view);
for (const item of items.Items) {
        let res = await item.Load();
	if (item.HasAttachments)
         {	
	    for (const attach of item?.Attachments?.items) {
		console.log('attach', attach);
		let result = await attach.Load();  //there's an error here
	     }
	}
}

and getting error:
image

Or other variant:

for (const attach of item?.Attachments?.items) {
		console.log('attach', attach);
		let result = await attach.Load([attach.id]);  //there's an error here
	    // }
}

and getting error:
image

Maybe there is a solution to this problem? Thanks for the help.

@peakala
Copy link

peakala commented May 4, 2024

Hi, I have a similar issue.
I can get the ItemAttachment but its attribute "item" is empty, so I cannot retrieve anything of the eml attachment... but the name.

So no access to the body nor to the inner attachments.
The method load on these attachments gives
throw new ArgumentException_1.ArgumentException(ExtensionMethods_1.StringHelper.Format("The element at position {0} is invalid", count), paramName, e);

I am about to switch to python, a first prototype works...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants