{"id":286,"date":"2018-07-16T16:21:13","date_gmt":"2018-07-16T16:21:13","guid":{"rendered":"https:\/\/www.harepoint.com\/Blog\/?p=286"},"modified":"2019-03-22T11:40:08","modified_gmt":"2019-03-22T11:40:08","slug":"infopath-metadata-sharepoint-document-library","status":"publish","type":"post","link":"https:\/\/www.harepoint.com\/Blog\/infopath-metadata-sharepoint-document-library\/","title":{"rendered":"Transferring metadata from an InfoPath form to SharePoint document library fields"},"content":{"rendered":"\n<ul>\n    <li><a href=\"#concept\">The Concept<\/a><\/li>\n    <li><a href=\"#workflow\">The SharePoint Workflow<\/a><\/li>\n    <li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n<p>With <b><a href=\"\/Products\/SharePoint-Workflows\/Default.aspx\">HarePoint Workflow Extensions<\/a><\/b>, it is possible to easily convert an InfoPath form to PDF, with just a single workflow action:<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/infopath-to-pdf-activity-1.png\"><\/p>\n<p>Beside just the conversion, it is often convenient to <b>transfer metadata from an InfoPath form to the target document library<\/b> so that users could then search the PDF form by metadata. This can also be achieved with HarePoint Workflow Extensions and <b>QueryXML<\/b> action.<\/p>\n<a name=\"concept\"><\/a>\n<h2>The Concept<\/h2>\n<p>This is an example of a form:<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/form-example-2.png\"><\/p>\n<p>An XML file for this filled form looks as follows:<\/p>\n<p><a href=\"\/Pictures\/Articles\/form-example-xml-3.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" src=\"\/Pictures\/Articles\/form-example-xml-3.png\"><\/a><\/p> \n<p>You can use <b>Query XML<\/b> action to retrieve data from the form. In order to use this action, you need to know <b>XPATH<\/b> for each data field you are going to transfer. It can be obtained from InfoPath application as follows:<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/xpath-infopath-form-4.png\"><\/p> \n<p>In this example, XPATH for <b>Birthday<\/b> field is <b>\/my:myFields\/my:Birthday<\/b><\/p>\n<a name=\"workflow\"><\/a>\n<h2>The Workflow<\/h2>\n<p>Here is an <b>example of a workflow<\/b> that retrieves metadata from an InfoPath form (<b>FirstName<\/b> and <b>LastName<\/b> fields), converts this form to PDF, and then updates document library fields <b>Contact First Name<\/b> and <b>Contact Last Name<\/b> accordingly:<\/p>\n<p><a href=\"\/Pictures\/Articles\/workflow-example-5.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" src=\"\/Pictures\/Articles\/workflow-example-5.png\"><\/a><\/p>\n<p>The three important actions in this workflow are explained below:<\/p>\n<ol>\n    <li><b>Get Properties Step<\/b>\n        <p>The workflow starts on a list item with InfoPath form. First, it reads the entire XML content of a current form, and then retrieves <b>First Name<\/b> and <b>Last Name<\/b> fields\u2019 values from it using <b>Query XML<\/b> and their <b>XPATHs<\/b>.<\/p>\n    <\/li>\n    <li><b>Building a URL of an output PDF file<\/b>\n        <p>An important step is to get a URL to the output PDF file.The URL consists of three parts: target document library URL (stored in <b>Library Url<\/b> variable); the file name which is the same as the original form name, so it is <b>Current Item:Name<\/b> lookup; and a <b>.pdf<\/b> file extension:<\/p>\n        <p><img decoding=\"async\" src=\"\/Pictures\/Articles\/output-pdf-url-6.png\"><\/p>\n    <li><b>Updating document library fields<\/b>\n        <p>Finally, the workflow updates the fields of a document library for the PDF document. For that, <b>Update List Item at URL<\/b> action from <b>HarePoint Workflow Extensions<\/b> is used, as follows:<\/p>\n        <p><img decoding=\"async\" src=\"\/Pictures\/Articles\/updating-document-library-fields-7.png\"><\/p>\n        <p>In this example, <b>Contact First Name<\/b> and <b>Contact Last Name<\/b> are the metadata fields in the document library that will receive <b>First Name<\/b> and <b>Last Name<\/b> values from an InfoPath form accordingly.<\/p><\/li>\n<\/ol>\n<a name=\"conclusion\"><\/a>\n<h2>Conclusion<\/h2>\n<p>In this article, we have seen that it\u2019s not only possible to just convert an InfoPath form to PDF with <a href=\"\/Products\/SharePoint-Workflows\/Default.aspx\">HarePoint Workflow Extensions<\/a>, but also various further scenarios can be accomplished. In particular, the metadata from an InfoPath form have been transferred to a document library fields, making document search much more efficient.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The article shows that it\u2019s not only possible to convert an InfoPath form to PDF with <b>HarePoint Workflow Extensions<\/b>, but also various further scenarios can be accomplished. For example, the metadata from an InfoPath form can be transferred to a document library field, making document search much more efficient.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[8,25],"_links":{"self":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/286"}],"collection":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":17,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/286\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}