Options strict on disallows implicit conversions from ‘attachment’ to ‘Iresource’

Hi All,
as per client Requirement, we need to upload email attachments to Blob storage directly without using local storage.
Please help on this.

Hi @Vijay_Singh

What is the datatype of the file to upload variable?


If you can use cloud storage via explorer extension, the following might work.


Hi @Yoichi this worked but still saving attachments into project folder, we want save directly to Blob Storage without using any local source drive.

want to save all email attachments to Azure Blob container without saving to local drive or any temp localation

@Vijay_Singh You are supposed to give full path of the file .I think you need to save the file somewhere to do this.

we can’t save file locally as per client restrictions.
i am looking to upload email attachment to Azure Blob Storage


Is it possible manually first to upload a file directly from email to blob without involving saving it to local?


same i am looking for
Client didn’t want to first save file locally then blob storage.
if any such solution feasible please let me know


I believe even manually it is not possible…One thing you can check is either save it first and then delete after that


if there is a shared drive which is safe for client then you can save it there and then upload it so that it is not saved locally as well


To save email attachments directly to Blob storage without using local storage in UiPath, you can use the following steps:

  1. Use the Get IMAP Mail Messages activity to retrieve the email messages containing the attachments you want to save to Blob storage.
  2. Iterate through the retrieved email messages using a For Each loop.
  3. For each email message, use the Get Attachments activity to retrieve the attachments.
  4. Iterate through the attachments using another For Each loop.
  5. For each attachment, use the Upload File to Azure Blob Storage activity to upload the attachment to Blob storage.

Here is an example of how this could be implemented in UiPath:
// Set the email account and folder where the email messages are stored.
string emailAccount = “user@example.com”;
string folder = “Inbox”;

// Use the Get IMAP Mail Messages activity to retrieve the email messages.
IEnumerable messages = GetIMAPMailMessages.GetMessages(emailAccount, folder);

// Iterate through the email messages.
foreach (MailMessage message in messages)
// Get the attachments for the current email message.
IEnumerable attachments = GetAttachments.Get(message);

// Iterate through the attachments.
foreach (Attachment attachment in attachments)
    // Upload the attachment to Blob storage.
    UploadFileToAzureBlobStorage.Upload(attachment.ContentStream, "mycontainer", attachment.Name);

This code first uses the Get IMAP Mail Messages activity to retrieve the email messages from the specified email account and folder. It then iterates through the messages and uses the Get Attachments activity to retrieve the attachments for each message. Finally, it iterates through the attachments and uses the Upload File to Azure Blob Storage activity to upload each attachment to Blob storage.

Thanks for response

but i am able to use this
UploadFileToAzureBlobStorage.Upload(attachment.ContentStream, “mycontainer”, attachment.Name);

can you explain little more
i have two variable to upload into blob
we can use only one

one variable is String type which have full path
and second variable is IResource (UiPath.Platform.ResourceHandling.IResource) type

and in attachment we have attachment type variable through for each