kapilkjoshi

Save Attachments from NWC Form to SharePoint list item using OneDrive as Default File Store

Blog Post created by kapilkjoshi Champion on Jul 19, 2018

Objective of this project is to ask vendors and partners fill out a form with their company details. This information needs to be saved in SharePoint for internal team to look over and process further. The supplementary documents uploaded with this form also needs to be available internally.

 

The attachment control in NWC form uploads all the files to Default file storage. The available locations for default storage is Dropbox for Business, Box, Citrix ShareFile, Google Drive and MS OneDrive for Business. Files cannot be saved directly into SharePoint (as of now). For this example, I am utilizing MS OneDrive for business to store the files.

 

Here is what my workflow looks like:

The first step in the workflow is to create the item in the SharePoint list using the information submitting in the form. Then comes other steps.

I'm counting the number of attachment to check if the count is more than 1. This mean the workflow will execute the loop only if there is an attachment. You do not have to add this check if the attachment field is mandatory.

Next, we have to loop through the Attachment collection and get the files. For this purpose, create a variable - varAttachmentFile of type File.

 

 

and add it as an attachment to SharePoint list item. Select variable as an option for the File. Specify varFileAttachment here.

 

 That’s it. If there is any cleaner/easier way to work with attachment and save to SharePoint list, please post your suggestions. We are all learning here.

Thanks to Gonzalo Marcos for providing inputs.

Outcomes