I tried to deploy a simple form to the SharePoint location http://sharepoint.local. – This location is a root site collection!!!
I got the error:
The following URL is not valid: “http://sharepoint.local”
I swear: It is valid!!!
The URL uses a host header name. Specifying the Central Administration URL (using the machines name) did work at the same time.
Than I activated the network adapter of the virtual machine to have Google available in the machine to research into the problem. – In this moment the problem was gone! – I turned off the network adapter and the problem was back. – OK. That’s it. – Deactivating the “System Event Notification Service” (net stop sens at command line) solved the problem. But you should restart the service as soon as possible!
This is not easy. It took me some days. – Now it works!
Here I’ll show you how to create a List Form for a SharePoint List using InfoPath 2010. Therefore you need SharePoint 2010 Server with Enterprise CALs! – With InfoPath Forms Services it’s possible to render List Forms (“New”, “Edit” and “Display” forms) as browser enabled InfoPath forms. This is really, really cool!
9. Open the site in the browser. Navigate to the “Test List 1”. Select “Edit in SharePoint Designer” from the “Site Actions” menu.
10. In SharePoint Designer 2010 open the “Lists and Libraries” from the “Navigation” pane and open the “Test List 1”.
In the Ribbon you’ll see the command “Design Forms in InfoPath”.
Click the command button and select “List Item” in the drop down menu.
Now InfoPath Designer 2010 opens…
11. In InfoPath Designer 2010 modify the form.
(I will not modify it.)
Press the “Publish” button on the Shortcut Menu:
12. In SharePoint Designer 2010 choose “All Files” from the “Navigation” pane. Click “Lists”.
Click “TestList1”.
Click “Item”.
Right-click “template.xsn”. Select “Properties…” from the context menu.
Select the “Location” from the properties dialog.
Copy the URL and open it in a new browser window. You’ll get a “File Download” dialog.
Save the file to a temporary location, e.g. to the Desktop.
13. Add a new “Module” project item and name it “Form”.
Open a Windows Explorer. Navigate to the Desktop. Drag the file “template.xsn” from the Desktop into the “Form” module inside the Visual Studio project.
Modify the “Elements.xml” file of the “Form” module.
14. Add a new “Module” project item and name it “FormPages”.
Into the “Elements.xml” file of this module enter the following code:
During deployment this creates the form aspx pages that will host the InfoPath Web Part that renders the form at runtime.
In the XML code there are several references to the destination list. All of them have to be set to “Lists/TestList1”. All the code needs to remain unmodified. Don’t change “WPTypeId” attributes! “{b1dc92e2-8558-f555-ae81-35ed9ddf1644}” is the identifier for InfoPath Render Web Part.
BUT change the “ID” attributes of the three “WebPart” tags! Use the “Create GUID” tool from the “Tools” menu of Visual Studio 2010.
15. Now open the “Schema.xml” file of the List Definition project item of “Test List 1”. Add the following code at the before the closing tag of our list content type.
This will define the “template.xsn” to be a “InfoPath Forms Services” file ().
17. Deploy the project.
18. Open the browser and navigate to the “Test List 1”.
Click “Add new item”…
19. HERE WE ARE!
But if you enter values and try to save you get this error:
This is caused by the missing “Title” field inside the form. This field is marked as mandatory so you need to define it or to remove it from the Content Type and modify the form.
We will do the last one now.
20. In Visual Studio modify the “schema.xml” file of the “Test List 1”. Insert the marked line of code inside the “FieldsRefs” tag of the content type with id starting “0x01…”.
Now search for “LinkTitleNoMenu” in the schema.xml file. Replace this “view field reference” with “Edit”.
Now search for “LinkTitle” and replace it with “Edit” too.
21. In Visual Studio look for “template.xsn” in “Form” path in the Solution Explorer. Right-Click the project item and select “Open Containing Folder”.
22. In Windows Explorer right-click the file “template.xsn” and click “Design”. The InfoPath 2010 Designer will open.
23. In InfoPath 2010 you’ll see that “Title” cannot be removed. To remove it you would need the edit the xsn file with Notepad: XSN is a CAB file. So you can rename it to cab, extract it’s content, modify the “manifest.xfs” file and compress the folder as CAB file named “template.xsn”… (If you need assistance on this please post as comment.)
In the “Fields” pane select “Title”.
(This is the “advanced view” !)
Click the arrow behind the element. Click “Properties” in the context menu.
Uncheck “Cannot be blank”. Click the “OK” button. Save the file. Don’t press “Publish” on the upcoming dialog. Just press “Save”!
Quit InfoPath.
Deploy the project.
24. In Internet Explorer refresh you site and add a new item to the “Test List 1”.
You’ll see: the “Title” column is gone. Now we have a “Edit item” column on the list view.
Now add an item.
Save it.
25. HERE WE ARE AGAIN!
It works for me now!
Just for testing purpose select the list item and click “View Item” on the Ribbon.
You will see the list item in a read-only InfoPath browser form!! – If you click “Edit” on the Ribbon, you’ll be able to edit the item.
2. I create a document library where I store my InfoPath template(s).
3. Open InfoPath Designer. Open the downloaded InfoPath form (see step 1).
4. Go to “File” menu.
=> Click “Publish your form”
=> On the first time you will be redirected to “Publish” sub menu.
=> On “Publish” menu: Click “Quick Publish” or “SharePoint Server”
A wizard starts…
On the first page enter the URL of the destination site.
On the second page I choose “Site Content Type”. => So you can use the form on multiple lists.
Create new Content Type.
Enter the name of the Content Type.
Specify the location where the form template will be saved. This URL will be used for the Content Type. You know: A Content Type can have a document template setting that is used to create new items (documents) based on this Content Type. The URL will be stored in the Content Type.
Add all form columns to the resulting Content Type. This columns will be available in the SharePoint list items that represent a saved form. (Here I choose some columns for this example…)
Now you are almost finished. – Click “Publish”…
That’s the result for that:
4. Go to the browser. Open your SharePoint site.
=> Click “Libraries” in the Quick Launch.
=> Create a new Form Library like this:
Click “Library Settings” in the Ribbon.
Edit the “Advanced Settings” of the library.
=> Select the option “Allow management of content types?” May be other options. Then save.
Now edit the Content Types of the library on the “Library Settings” page:
=> Press “Add from existing site content types”.
Now choose your previously created content type “TravelPreference”. Then press “OK”.
Optional: Remove the standard “Form” content type from the list.
Now it looks like this:
5. In InfoPath Designer
=> Open the “File” menu.
=> Open the “Info” sub menu.
=> Click “Submit Options”
Choose “To SharePoint Library”
In the wizard: Specify the location for saving the filled forms:
Go through the next wizard page… Click “Finish”
=> Open the “File” menu.
=> Open the “Info” sub menu.
=> Click “Form Options”
Open “Compatibility” tab. Choose Form Type “Web Browser Form” and enter the site URL:
Click OK.
The “Design Checker” will open. There are some problems in the form:
This results in setting the form type to “Web Browser Form”: Such a form does not have some features. – Now remove the fields from the form…
Click “Refresh” in the “Design Checker” pane.
Now there’s only a warning. You can ignore this.
=> Open the “File” menu.
=> Open the “Info” sub menu.
Click “Quick Publish”
That’s it:
6. Go to the browser. Open your SharePoint site. Open your “TravelPreferences” list.
=> Click “Add new document”
NOW YOU’LL GET YOUR BROWSER FORM!!!
Fill it out!
Click “Submit” (NOT: “Save” => You can disable the “Save” button in InfoPath Designer => “File” menu => “Info” pane => “Advanced form options” => “Web Browser” tab)
After clicking “Submit” you’ll get a document in your form library:
This can be used with Workflows and any other SharePoint functionality…