The File inline functions allow the retrieval of file information, including content, from various sources. This Knowledge Base article describes how to use these functions.
In the Function Browser, the Files node has been added that includes the following functions:
Get File From Content - Enables a user to get a file from data fields, expressions, base64-encoded data and other items containing the file’s content, and allows you to specify a filename.
Get File From Location - Enables a user to get a file from a file location which must be accessible at runtime, and allows you to specify a filename.
Get File From SharePoint Item Reference - Enables the user to get a file from a SharePoint 2010 Item Reference containing one or more documents.
Get File From SharePoint 2010 - Enables the user to get a file from a SharePoint 2010 document library.
Get File From InfoPath Attachments - Enables the user to get all documents contained in an InfoPath 2010 attachment field node.
||Note: The return type for all FILE Inline Functions is STRING, because of the fact that the functions resolve to an XML structure containing the file name and the file contents.
For more details on the individual File Inline Functions, see the following topic and related sub topics in the help documentation:
We are using a scenario where a Word document is converted to a PDF document in a SharePoint 2010 Library and we want to add the PDF document as an attachment to an E-mail. We will use the Get File from SharePoint function to achieve this.
Follow the steps below to set up the scenario as described above.
- Create two SharePoint Document Libraries where (1) a file can be uploaded and (2) a PDF document can be saved.
- Create a SharePoint Workflow Integration process on the first SharePoint Library that converts the file that is uploaded to the first library to a PDF document and saves it to the second SharePoint Library.
- Create a K2 Studio or a K2 Designer for Visual Studio SharePoint Workflow Integration process on the second SharePoint Library that starts when an item is created and sends a mail.
- Now edit the E-mail Event and go to the E-mail Settings step of the wizard.
- Click on the ellipsis next to Attachments at the bottom of the screen:
- Open the Files node, select the Get File from SharePoint function and click Add.
- The Configure Function screen opens. Provide the SharePoint site, Library Name and Document Name of the SharePoint Library where the PDF document is saved. Finish the wizard.
- Save and deploy the processes.
- Start an instance of the first process by uploading a Word document to the first SharePoint Library.
- Both processes will finish without any human intervention.
- Open the mailbox of the person you selected the E-mail to be sent to.
- An E-mail will be delivered that contains the PDF document as an attachment.