In this video demo, Phil Newman from the InfoPath program management team shares some tips and tricks for debugging InfoPath forms with sandboxed code on SharePoint server 2010.
Here is this link to the ULS viewer tool that is used in the demo:
Filters:
So you’ve heard about SharePoint list form customization in InfoPath 2010 and you’ve seen the cool demos. But you may be asking yourself – What’s the difference between list and library forms and when should I use one or the other? In this post, we will answer these questions and provide guidance on when to create list vs. library forms.
When designing InfoPath forms for SharePoint 2010, the first choice you need to make is between a SharePoint list form and a SharePoint form library form.
Recommendation
Use a list form if you just need to collect data and store it on SharePoint. Use a form library form if you want more advanced functionality such as complex or repeating data or code.
SharePoint list forms store data directly in a SharePoint list. Each control (e.g. text box) in the form is bound to a column in the list. SharePoint list forms are directly connected to the list, which means that you don’t have to worry about setting up the publish and submit locations. Form library forms store data in XML files in a SharePoint form library. This means they are more flexible and you can do more with them. For example, they can be configured to save drafts and submit to different locations. However, they are more complex to work with and require more decisions to be made during configuration.
Because the way data is stored between these template types is different, it is not possible to switch between them.
Overall, both list forms and form library forms support much of the key functionality that InfoPath provides, such as data validation, custom rules, default values, and control over visual layout. In most cases, a list form will be sufficient for your needs. Lists have the most straightforward design and form management experience. However, for more complex scenarios such as repeating data or the need to add code, a form library may be necessary.
Please leave a comment if you have any further questions!
Daniel Broekman and Kate Everitt
InfoPath Program Managers
This week’s cool form is a feature request issue tracking list used by the Visio team. It’s divided into two main sections, the separate status section allows readers to jump directly to the information they care most about. It uses picture buttons to allow selection between ‘Office 14’ and ‘Office 15’ and to show which one is currently selected. This form also dynamically generates the proper direct link to the bug database based on the bug ID that is entered.
If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -
The most popular submissions will be featured on our blog in future posts.
Check out other Cool Forms here.
Check out the new Capacity Management Resource Center for SharePoint 2010 that went live when Office 2010 released to manufacturing last Friday, April 16th. The InfoPath capacity planning document along with a refresh of the Capacity Planning Tool Kit are now available.
The Capacity Management Resource Center contains resources to help you with capacity management in your Microsoft SharePoint Server 2010 environment—map your solution design to a farm size and set of hardware that supports your business goals.
Hi, my name is Laura Harrington, and I’m a program manager on the InfoPath team. In this short video demo, I will show how you can optimize the form filling experience for different tasks and users by creating multiple custom views in your customized SharePoint list forms.
Find the new locations of InfoPath 2007 commands in InfoPath 2010. The InfoPath 2010 menu to ribbon reference workbook contains tables that list the old menu commands and show where in InfoPath 2010 those commands are located.
This Excel workbook is now available to download from http://office2010.microsoft.com/en-us/templates/CL101817133.aspx.
Hi, this is Frank Mueller, a developer on the InfoPath team. In this post which is the first of two blog posts about the Person / Group picker, I want to tell you about the improvements we’ve made to this control in InfoPath 2010.
The Person / Group Picker (aka contact selector) control allows you to type or select users and groups from a SharePoint site, and validate those users against a directory provider. In InfoPath 2010, the Person / Group Picker control is now a 1st class citizen and is available out of the box in the controls gallery! With the new and improved person / group picker, we have eliminated the detailed steps required to insert and configure this control in your forms (the blog post outlining these steps has been one of our most viewed posts). In addition to making the control available in the controls gallery out of the box, we have added new features to improve its integration into SharePoint scenarios.
For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, click here.
From the Controls Gallery on the Home tab or the Controls task pane, click the Person/Group Picker to insert it into the view.
The Person/Group Picker needs to connect to a SharePoint site to be able to function. Specify the SharePoint site as follows, unless you have already published the form to a SharePoint site, in which case that site will be used.
In InfoPath 2010 it is now possible to mark the field the people picker is bound to as Cannot be blank. This means that users will not be able to submit a form without having entered at least one valid person or group in the control. You can mark a field as required by doing the following:
Preview the form in InfoPath Designer or publish the form to a SharePoint site and view the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively, you can click the “Address book” button to perform a search if you do not know the complete name of the user.
For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, check out my other post here.
Hi, this is Frank Mueller again and this is the second of two posts that I’ve written about the InfoPath 2010 Person / Group picker control. InfoPath 2007 form templates containing the Person/Group Picker control (formerly named Contact Selector) will continue to work in InfoPath 2010 the same way they used to as long as the form template remains in the InfoPath 2007 Form Template format. However, if you wish to upgrade your form template to InfoPath 2010 to take advantage of newly added functionality for the control (see this blog post for more details) or other exciting new features, you will have to perform the steps outlined in this post in order to use the Person/Group Picker.
After the form template is saved in the new format, you will notice that each Person/Group Picker in your view will show the following error message when you hover your mouse cursor over it.
Also the Design Checker task pane appears, indicating that the version of the Person/Group Pickers in the view is not compatible with InfoPath 2010. For each Person/Group Picker in all views, do the following:
Preview the form in InfoPath Designer or publish the form to a SharePoint site (be sure to publish to a different location in order to be able to view previously filled out forms) and view the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively you can click the “Address book” button to perform a search if you do not know the complete name of the user.
To configure advanced control properties that are new in InfoPath 2010, such as limiting the entities the control can pick, as well as requiring the control to contain data before the form can be submitted, follow the steps in this blog post.
If you added the control to your InfoPath 2007 form template following the steps outlined in this blog post, you will have created a data connection called Context, which specifies the SharePoint site the Person/Group Picker should connect to. Follow these steps to recover the data connection XML file and obtain the URL of SharePoint site:
It was brought to our attention that external e-mails that were sent to coolform@microsoft.com were not getting through. This issue has now been resolved.
This week’s cool form displays your local weather forecast by using a REST Web Service data connection to pull in weather information from an online weather service. There are two views to the form, one minimal and one extended. The form contains linked picture controls that use rules to concatenate the Web service data and generate a URL pointing to images on the weather site. By hosting this form inside the InfoPath form Web part, you can display the latest weather forecast information on your SharePoint portal pages.
Minimal View:
Extended View:
For more information about using REST Web Service data connections with InfoPath forms, see our earlier blog post http://blogs.msdn.com/infopath/archive/2010/02/11/add-a-dynamic-map-to-a-contact-form-using-rest-web-services.aspx.
If you want to learn more about InfoPath and SharePoint 2010 directly from the Microsoft product team, then sign up for the InfoPath 2010 Academy Live Series.
There are 2 remaining sessions in the series. The next session “Form-Driven Mashups using InfoPath and SharePoint 2010", presented by Nick Dallett, an InfoPath program manager lead, will take place on Wednesday, April 7th from 8:30 AM to 10:00 AM (PST).
If you missed our first 2 sessions, “An introduction to SharePoint applications using InfoPath 2010” and "Building SharePoint Applications with InfoPath 2010", you can view them on demand here. Just click the “Register Now” button.
This is a great opportunity to learn all about our new features and scenarios directly from the product team, so sign up now!
In this video demo, Phil Newman shows how you can write managed code in an InfoPath form to add items to a SharePoint list, and then publish this form as a sandboxed solution to SharePoint.
In InfoPath 2010, forms with code can now be published directly to SharePoint without requiring the farm administrator to approve and upload them! These forms run in a sandboxed environment which protects other resources on the SharePoint server from malicious code.
For more details on publishing InfoPath forms with code as sandboxed solutions to SharePoint, see Phil’s earlier post Introduction to Sandboxed Solutions - Sort data in repeating tables using managed code.
Here’s the code that was used in this demo:
NOTE: To develop code using the SharePoint object model, you need to add a reference to Microsoft.SharePoint.dll to your VSTA project. This DLL is installed in %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\ISAPI with your licensed copy of Microsoft SharePoint Server.
public void school_Changed(object sender, XmlEventArgs e) { using (SPSite FormSite = new SPSite(ServerInfo.SharePointSiteUrl.ToString())) { using (SPWeb FormWeb = FormSite.OpenWeb()) { //Get the list and query for the item - "Schools" is the name of the list I am retrieving SPList LookupList = FormWeb.Lists["Schools"]; SPQuery MyQuery = new SPQuery(); //"Title" is the field where I keep the school name ///my:myFields/my:school is the xpath to the school field MyQuery.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + GetDomValue("/my:myFields/my:school") + "</Value></Eq></Where>"; SPListItemCollection ReturnedItems = LookupList.GetItems(MyQuery); //Add the item to the lookup list if no items were returned in the query if (ReturnedItems.Count == 0) { SPListItem NewItem = LookupList.Items.Add(); ///my:myFields/my:school is the xpath to the school field NewItem["Title"] = GetDomValue("/my:myFields/my:school"); //Set AllowUnsafeUpdates = true to update the database FormWeb.AllowUnsafeUpdates = true; NewItem.Update(); FormWeb.AllowUnsafeUpdates = false; } } } } private string GetDomValue(string XpathToGet) { return this.CreateNavigator().SelectSingleNode(XpathToGet, this.NamespaceManager).Value; }
public void school_Changed(object sender, XmlEventArgs e)
{
using (SPSite FormSite = new SPSite(ServerInfo.SharePointSiteUrl.ToString()))
using (SPWeb FormWeb = FormSite.OpenWeb())
//Get the list and query for the item - "Schools" is the name of the list I am retrieving
SPList LookupList = FormWeb.Lists["Schools"];
SPQuery MyQuery = new SPQuery();
//"Title" is the field where I keep the school name
///my:myFields/my:school is the xpath to the school field
MyQuery.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + GetDomValue("/my:myFields/my:school") + "</Value></Eq></Where>";
SPListItemCollection ReturnedItems = LookupList.GetItems(MyQuery);
//Add the item to the lookup list if no items were returned in the query
if (ReturnedItems.Count == 0)
SPListItem NewItem = LookupList.Items.Add();
NewItem["Title"] = GetDomValue("/my:myFields/my:school");
//Set AllowUnsafeUpdates = true to update the database
FormWeb.AllowUnsafeUpdates = true;
NewItem.Update();
FormWeb.AllowUnsafeUpdates = false;
}
private string GetDomValue(string XpathToGet)
return this.CreateNavigator().SelectSingleNode(XpathToGet, this.NamespaceManager).Value;