{"id":150,"date":"2010-11-30T19:44:20","date_gmt":"2010-11-30T19:44:20","guid":{"rendered":"http:\/\/www.stuartroberts.net\/?p=150"},"modified":"2011-12-14T21:40:18","modified_gmt":"2011-12-14T21:40:18","slug":"deploying-infopath-form-sharepoint","status":"publish","type":"post","link":"http:\/\/www.stuartroberts.net\/index.php\/2010\/11\/30\/deploying-infopath-form-sharepoint\/","title":{"rendered":"Deploying InfoPath Form to SharePoint 2010 Site"},"content":{"rendered":"<p>Deploying an InfoPath form to SharePoint 2010 is relatively straight forward, as long as you remember a few simple steps.<\/p>\n<p>For an easier deployment experience, avoid code behind (managed forms) in your InfoPath form unless you really have to.  That\u2019s for another day, so this post will concentrate on how to deploying an InfoPath form with no associated code behind files.<\/p>\n<p>Open InfoPath and either open or create a form.  I\u2019m not going to go into how to hook up the form with a data connection, just how to configure and publish it.<br \/>\n<!--more--><br \/>\nOnce you\u2019re happy with your form, have added any relevant data connections and wired up a submit button, you\u2019ll need to set the trust level to <em>Domain<\/em>.  By default this will be set to <em>Restricted<\/em>, which is too low for use in SharePoint.  If you try to deploy a form with a restricted trust level the form will not be able to:<\/p>\n<ul>\n<li>use data connections (with the exception of submitting via email)<\/li>\n<li>run managed code or script<\/li>\n<li>use custom or ActiveX controls<\/li>\n<li>Process rules associated with opening the form<\/li>\n<\/ul>\n<p>To change the security level, click on the <em>File<\/em> tab in the ribbon and then select <em>Info<\/em> from the left hand menu (should be auto selected).  Click <em>Advanced form options<\/em> from the list provided.  This will load the <em>Form Options<\/em> dialog.  Select the <em>Security and Trust<\/em> category and change your settings to the <em>Domain<\/em> security level, as shown in the following screenshot:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Security-and-Trust.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Security-and-Trust-300x91.jpg\" alt=\"\" title=\"Security and Trust\" width=\"300\" height=\"91\" class=\"aligncenter size-medium wp-image-158\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Security-and-Trust-300x91.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Security-and-Trust.jpg 672w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To deploy the form from SharePoint you\u2019ll need to publish the form and use the published version within your SharePoint project.  Stay on the <em>File<\/em> tab and select <em>Publish<\/em> from the left hand menu.  From the list of options presented, click <em>Publish form to a network location or file share<\/em>.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-to-network.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-to-network-300x66.jpg\" alt=\"\" title=\"Publish to network\" width=\"300\" height=\"66\" class=\"aligncenter size-medium wp-image-156\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-to-network-300x66.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-to-network.jpg 533w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Select a location to publish the form to (you\u2019ll need to make sure that this is the file you include in your SharePoint deployment project) and give it a name.  As we\u2019ll be publishing this form to SharePoint and all users will access it from the form templates gallery, make sure the second screen of the Publishing Wizard does not contain a path.  SharePoint will then ensure users can access the form, so no need to provide an alternate access URL.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-wizard.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-wizard-300x85.jpg\" alt=\"\" title=\"Publish wizard\" width=\"300\" height=\"85\" class=\"aligncenter size-medium wp-image-157\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-wizard-300x85.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Publish-wizard.jpg 571w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Click next and OK the popup ignoring the warning about users not being able to access the form.  Finally, click <em>Publish<\/em> to create a published version of your form.<\/p>\n<p>From within your SharePoint project, you\u2019ll need to add the published InfoPath form and configure a feature to correctly deploy it.  To add the form, create a new module, deleting the Sample.txt file that it automatically creates.  Add the published form to this module.  Your module\u2019s elements XML file should now look something like the following:<\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Elements xmlns=\"http:\/\/schemas.microsoft.com\/sharepoint\/\">\r\n  <Module Name=\"FormsModule\">\r\n    <File Path=\"FormsModule\\aform.xsn\" Url=\"PublishedForms\/aform.xsn\" \/>\r\n<\/Module>\r\n<\/Elements>\r\n<\/pre>\n<p>Next, you need to edit the manifest for the feature that deploys the form module.  Open the feature in Visual Studio and click the <em>Manifest<\/em> link at the bottom of the screen.<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-link.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-link-300x65.jpg\" alt=\"\" title=\"Manifest link\" width=\"300\" height=\"65\" class=\"aligncenter size-medium wp-image-155\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-link-300x65.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-link.jpg 325w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>From the manifest page, click the <em>Edit Options<\/em> link, which will bring up an editor window similar to the following:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edit-options.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edit-options-300x104.jpg\" alt=\"\" title=\"Manifest edit options\" width=\"300\" height=\"104\" class=\"aligncenter size-medium wp-image-153\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edit-options-300x104.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edit-options.jpg 505w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Change it to contain the following text:<\/p>\n<p><a href=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edited.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edited-300x141.jpg\" alt=\"\" title=\"Manifest edited\" width=\"300\" height=\"141\" class=\"aligncenter size-medium wp-image-154\" srcset=\"http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edited-300x141.jpg 300w, http:\/\/www.stuartroberts.net\/wp-content\/uploads\/2010\/11\/Manifest-edited.jpg 466w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You\u2019ll need to change the value for the key <em>RegisterForms<\/em> so it points to the name of the module you created earlier.  This will register your form(s) when the feature is activated, providing you follow the next set of steps.<\/p>\n<p>From the feature\u2019s main page, bring up the properties window for it and set the following property values:<\/p>\n<p><em>Receiver Assembly<\/em> = Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c<br \/>\n<em>Receiver Class<\/em> = Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver<\/p>\n<p>By hooking up the feature to use the WorkflowFeatureRecevier class from the Microsoft.Office.Workflow.Feature assembly, the property values added to the feature manifest will be loaded and processed as it is activated.  This ensures that your form is uploaded to the form templates gallery (in SharePoint) and registered correctly.<\/p>\n<p>You should now be able to use the form within your SharePoint instance, for example by using it as an instantiation form for a custom workflow:<\/p>\n<pre lang=\"xml\">\r\n<Elements xmlns=\"http:\/\/schemas.microsoft.com\/sharepoint\/\">\r\n  <Workflow\r\n     Name=\"Workflow name\"\r\n     Description=\"Workflow description\"\r\n     Id=\"70AE73A8-388D-4E15-AB75-4385BDE528B5\"\r\n     CodeBesideClass=\"CustomWorkflows.CustomWorkflowClass\"\r\n     CodeBesideAssembly=\"$assemblyname$\"\r\n     InstantiationUrl=\"_layouts\/IniWrkflIP.aspx\">\r\n    <Categories\/>\r\n    <MetaData>\r\n      <AssociationCategories>List<\/AssociationCategories>\r\n      <Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:aform:-myXSD- 2010-11-30T17-05-30<\/Instantiation_FormURN>\r\n      <StatusPageUrl>_layouts\/WrkStat.aspx<\/StatusPageUrl>\r\n    <\/MetaData>\r\n  <\/Workflow>\r\n<\/Elements>\r\n<\/pre>\n<p>You can get the URN for your InfoPath form by opening the form in InfoPath in design mode, changing to the <em>File<\/em> tab and clicking the <em>Form Template Properties<\/em> button, located to the right of the screen.  This will display a dialog which contains a field called ID, the content of which is the value required for the URN in the above XML.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deploying an InfoPath form to SharePoint 2010 is relatively straight forward, as long as you remember a few simple steps. For an easier deployment experience, avoid code behind (managed forms) in your InfoPath form unless you really have to. That\u2019s &hellip; <a href=\"http:\/\/www.stuartroberts.net\/index.php\/2010\/11\/30\/deploying-infopath-form-sharepoint\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[9,3],"tags":[84,81],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/plx2I-2q","_links":{"self":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/150"}],"collection":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":13,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":178,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/150\/revisions\/178"}],"wp:attachment":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}