Sometimes InfoPath doesn’t allow you to rename your main data source so you are stuck with a name that doesn’t necessarily match with the function of the form. This is very common for those of us that like to use Microsoft’s InfoPath templates as a head start. For example, a form designed based upon an InfoPath sample may include the "expenseReport" name. This is quite annoying especially when you need to compile the datasource with the "xsd /c" command and the output classname is less than helpful.
Below is the example of a form data source that was created using Microsoft’s “Expense Report” example form.
How to rename the your data source
If this field is disabled when you open the properties window you will need to follow the steps shown below to rename the datasource
Open your form
Select file >> Save as Source Files
Accept the signing message
*** Close the form *** don’t skip this step
Open the schema.xsd file from the location where you saved the source (if you don’t see the schema.xsd then your datasource is not complex so you can still rename it using the right mouse key >> properties)
Locate the element as shown below and rename it (sorry but you shouldn’t rename any of the target namespaces or xsns)
(update the <xs:element to match the name you would like without spaces
Save the shema.xsd
Open the original form and select Tools >> Convert Main Data Source
Select the schema.xsd file you modified previously
Choose No if InfoPath asks you "Do you want to add another XML Schema or XML document to the main data source?"
Voila, your main Data Source’s top level element is renamed
Ulysses Ludwig is a SharePoint architect with over 16 years in the IT and computer industry. Ulysses' primary focus is SharePoint but he dabbles in the latest web technologies and likes to develop software in his spare time.
Day after day I have users asking me how to get additional information about the selected user from the contact selector/people picker per my example at http://sharepointassist.com/2009/02/27/adding-a-contact-selectorpeople-picker-to-an-infopath-form/.