Not applicable

Moving Email Attachments to Document Library

Jump to solution

Hello everyone,

I am new to Nintex and have only created the most basic of workflows.  I need to set up a workflow that will allow me to extract email attachments from emails sent to a SharePoint team site Mailbox and store them in a Document library.

I am a Nintex customer using Nintex forms and workflows for Office 365.  I've been working at this for awhile and haven't had much luck.  I recently spoke to Mike Fitzmaurice at SharePoint Fest Chicago, and he said my best bet would be to post on here.

 Any and all ideas would be greatly appreciated!

Thanks,
Matt

0 Kudos
Reply
6 Replies
TomaszPoszytek
Automation Master
Automation Master

Re: Moving Email Attachments to Document Library

Jump to solution

Hello Matt Piggins‌! Your friend directed you to the right place  What you want to achieve is quite simple and doable using the "O365 Office upload file" action if you know the attachments names. But if you want to do it dynamically, so when your list item can have more than one attachment having custom names then you can make it in just 4 steps, using SharePoint list REST webservice:

First you need to build a dictionary for holding a Request Header. It should contain one record (key --> value):

Accept --> application/json; odata=verbose

Second you have to make a REST call to the SharePoint list from which you want to copy the attachments. You have to call the REST webservice using the following URL:

‍{Workflow Context:Current site URL}‍/_api/lists/getByTitle('[YOUR-LIST-NAME]')/items(‍{Current Item:ID}‍)/AttachmentFiles

You have to point to a particular item on the list (CurrentItem:ID). If you'd like to get all attachments from all items, you need to do it in the loop and for each item from the list get it's attachments.

To call a webservice ("Call HTTP Web Service" action) you should use the dictionary from the first step as a Request Header parameter and store the Response Content in a new Dictionary. You also have to store Response Code, but it is not being used by the process later:

Third, you need to work with the list of attachments. If you expect to have more than one in return, you should put the Response Content in foreach loop so that in each step you will query a single file URL. To get this value you have to get data from the following path from the Response Content using the "Get Item From Dictionary" action:

d/results([INDEX])/FileNameAsPath/DecodedUrl

For example:

The last thing (or the first one in case I described in the beginning) you should do is to use "Office 365 upload file" action to actually move the attachment to a destination library somewhere in your tenant. You just have to provide a URL to the attachment file you want to move and the destination, where you want to move the file. You have to also provide user credentials that have permissions in the destination library:

And that's it! Happy Nintexing

Regards,

Tomasz

View solution in original post

Reply
Not applicable

Re: Moving Email Attachments to Document Library

Jump to solution

Thanks for the help!

Will this allow me to move attachments to a library as they are received?

Best,
Matt

Reply
TomaszPoszytek
Automation Master
Automation Master

Re: Moving Email Attachments to Document Library

Jump to solution

of course it will. Just run your workflow on list item creation and your home

Reply
TomaszPoszytek
Automation Master
Automation Master

Re: Moving Email Attachments to Document Library

Jump to solution

‌ if you find my answer as helpful please mark it as a correct. This way other forum users will know that the solution is correct  Thanks!

0 Kudos
Reply
jacquenv
Workflow Hero

Re: Moving Email Attachments to Document Library

Jump to solution

THANK YOU for this post!  I was able to use the solution posted here to build a workflow attaching all of the documents from the form onto an email to send!  I am including this workflow for others to use!

0 Kudos
Reply
shaunlub
Design Canvas Artiste

Re: Moving Email Attachments to Document Library

Jump to solution

The 365 upload file action will require a password to be set inside the workflow - which would be restrictive if your organization has a regular password change policy; although you could have a purpose made account setup for this.

One other alternative that I have used recently is Microsoft Flow => which will let you move attachments from an 365 Outlook account to a SharePoint Online library. You can set conditions on the email such as Subject, From address, etc.

I find it works quite well. It would be nice if Nintex could harness this... but maybe that is the Ninex Cloud.....(not sure on that).

0 Kudos
Reply