I want to read the attachment name

I am reading the attachment name with following logic.

Resume_Downloads.xaml (13.0 KB)

Got the error:- an activity context can only be accessed within the scope of the function it was passed into.

Please give me the suggestions.
@vvaidya @ClaytonM

Do you know which activity is causing the error?

Also, you have some redundant code; I would change this part to this:

When you take the First of the Attachments, it’s already in the Attachment type, so using CType() is redundant.

If this other part is the problem here:

Then, I would suggest checking that each MailMessage in the list has a .Headers() that it can access - I’m just wondering if it is missing for some reason. I think to test this if you would need to run the messages through a loop. Of course, this is only if the error occurs at this place.


Oh also, you can try changing it from this:
DateTime.ParseExact(x.Headers("Date"), "MM/dd/yyyy HH:mm:ss", Nothing)

to this:
DateTime.ParseExact(x.Headers("Date"), "MM/dd/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture)


It’s work for me.

Thanks @ClaytonM

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.