In save attachment activity i get error



Argument ‘Attachments’: BC30512: Option Strict On disallows implicit conversions from
|‘IEnumerable(Of String)’ to ‘Attachment’. The selected value is incompatible with the property type.

can any one help me to solve these

hi @Monali_Vekariya

  • Open Save Email Attachments
  • Clear the Attachments (Out) field
  • Keep only: Email message = mail
  • Save to folder = folderPath

Save Email Attachments already saves all attachments, so looping mail.Attachments is unnecessary.

Hi @Monali_Vekariya

The error occurs because Save Email Attachments already processes all attachments internally.

It should not be used inside a For Each.

Remove the loop and let the activity save all attachments directly to the folder.

The Attachments (Out) property expects IEnumerable(Of Attachment), not a single attachment.

Cheers

Hey,

I guess there is a flaw in your workflow. Unlike your code, in your workflow you need to loop for each mail not mail.attachment.
For each mail you should save mail attachments that fits your rule. You can give the rule by filling Filter by filename parameter.

To sum up
Loop in mails
Fill the Filter by filename parameter in save mail attachment activity.

Save Email Attachments already handles all attachments internally, so looping through mail.Attachments causes the mismatch error.

  1. Open Save Email Attachments
  2. Clear the Attachments (Out) field
  3. Keep only:
    Email message = mail
    Save to folder = folderPath
  4. If you want to Filter by filename: .pdf, .xlsx

So, you don’t need For Each loop.

3 Likes

@MohammedShabbir

for each
in mail.Attachments
body-> if[System.IO.Path.GetExtension(attachment.Name).ToLower() = “.pdf”]

					   then assign   folderPath = Config("StandardFolder").ToString
						save attcchement
						log message("Saved PDF attachment: " & attachment.Name)
				           else
						if[System.IO.Path.GetExtension(attachment.Name).ToLower() = ".xlsx"]
						        then assign  folderPath = Config("CIFolder").ToString
							 save attachment
							 log medssage( "Saved Excel attachment: " & attachment.Name)
							else log message("Skipped unsupported attachment: " & attachment.Name)

what about these assign folderPath = Config(“StandardFolder”).ToString as you said i have attch image of my flow

Just make sure this Assign runs before the Save Email Attachments activity.

1 Like

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