Send Attachment as shared from OneDrive

Hello Community,

I want to send an email with attachments as shared from Onedrive. Every attempt failed because the UiPath Outlook send email activity, sends the attachments as copy (not as shared).

I can use VBA to send the attachments as shared as below:

Set OutApp = CreateObject("Outlook.Application")
Set OutlookItem = OutApp.CreateItemFromTemplate(*EmailTemplate*)
OutlookItem.Attachments.Add *FileFullOnlinePath*, 7

Is it possible to send as shared (code 7 in vba) via Outlook send email activity ?
Needs other activities package ?


Ji @nrok

You can try getting the link to the file in one drive by using office 365 activities and insert that link instead of attachment. Would this work for you?


Hi @Anil_G,

Thanks for your response.

For testing purpose, i tried manually to send and email with the web location of the file as attachment.

But sent it as simple attachment, not as web location file.

Hi @nrok

Why don’t you send the location in body directly so that it does not attach at all and it will only be a location


Hi again,

When i share direct the link or as hyperlink in HTML body, the user doesn’t get access automatic. (like attachment)

When clicked on link, the classic access issue message displayed.

Maybe should first give access to each file :frowning:


Hi @nrok

Yes you have to give access or you can give access to required users to a folder and place your files in the same folder always, so that they have access to it.

Or if you have required details then you can use office 365 activities to provide /share the file access

Or if you have a power automate you can write a power automate to give access to people once the file is created on sharepoint


1 Like

I try to avoid this solution (with folder), but maybe this is the best solution.
Also, i have found a work around, i send the email via Excel VBA where i can attach the file as web location and give access to this file automatic (like the first post).

Thanks @Anil_G

1 Like

Hi @nrok

You can try this as well

if you have required details then you can use office 365 activities to provide /share the file access

This way you need not give access to folder also

1 Like

Thanks, I will try with this when i take the required info from IT.

I run it with a work around now.


1 Like

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