How to send null value to attach files in send outlook mail activity


I want to have come flow for sending mail. Some cases I have to attach file along the mail and some no attach files. When i send empty value in the variable Filepath as in the below image. Facing error - Attachment missing. Is there a way to keep common flow with or without attachment for sending mails using Send Outlook mail activity.


Hi @Rajasegar94

It looks like I would use an IF statement to separate the task between the two conditions. This would require two separate Send Outlook main activities though, one for Then and the other for Else.

I am not sure if there is a way around it.

I think you could create one component for sending an email, and invoke it for both Then and Else, but change the input for one to not include the attachments?

This might save you time instead of creating two, but might not be ideal solution for you, depends on your project I guess.

Thanks @loginerror, I thought of the if condition but seems as a hardway.

@Alex_Cross, We cannot pass empty value to Attach file that is my concern.

You wouldn’t be passing a null input, I think I phrased it wrong, I meant in the case that “attachment = none” (whether that’s Then or Else) you could remove the “add attachments” part from the Email component.

If statements would work well here

There may be a way.
Use mailMessage approach.
This uses a InvokeMenthod so you can keep that in the if and keep you SendMail as a common part with mailmessage.

What do you think?

@nadim.warsi, Lot of Custom Assign involved in composing mail message.
May be having Send Outlook mail activity under IF/Else is the best approach of the available option.
Thanks Folks for your useful ideas.