Wednesday, November 28, 2012

Loading form Library(created programmatically) in InfoPath form

Scenario:
1) Form Library is created using Visual Studio 2010 ....follow the link below for steps of creating form library using visual studio.
http://microsofttechnologies.blogspot.com.au/2012/11/creating-sp-2010-form-library-using.html


2) Infopath form is created with few fields on it , when the user tries to publish the form to form library which was created using Visual Studio....it doesn't appear in Infpath Form Library list.


Solution:


Open List Definition in Visual Studio and change URL by removing List before slash 


Wrong-----This form library will not appear in infopath form when we try to publish a form and want to select a form library which was created before..


 
                OnQuickLaunch="TRUE"
                TemplateType="115"
                Url="Lists\ListURL"  
                Description="List Description">
 





Correct-----This form library will appear in infopath form when we try to publish a form and want to select a form library which was created before..
 
                OnQuickLaunch="TRUE"
                TemplateType="115"
                Url="ListURL"  
                Description="List Description">
 

Creating SP 2010 Form Library using Visual Studio 2010

1) Open Visual Studio, in New Project select SharePoint 2010 and then select an empty project. (Create an empty SharePoint project)

2) Add a new List or List based on selected content type. 

3) Open List template definition and change it to (List Template not list definition)
  
        Name="ListName"
        Type="115"        
        BaseType="1"  
        OnQuickLaunch="TRUE" 
        SecurityBits="11" 
        Sequence="120" 
        DisplayName="List Display Name" 
        Description="List Description" 
        Image="/_layouts/images/itfl.png"  
        DocumentTemplate="1000"/> 


4) Build the project and deploy it, it will create a form library in SharePoint with the name you specified above. 

Promoting Infopath form fields to SharePoint - with out duplication

Scenario:
SharePoint 2010 form library is created using object model or schema definition in Visual Studio 2010 and form is created in InfoPath 2010 using InfoPath designer, When the fields are promoted to SharePoint Form library from InfoPath form it duplicates the filed in Form Library.


Solution:
When you promote a field from infopath form to sharepoint it creates a new field in form library with the name of promoted field, even if the field with that name exist it  creates a new field and give it different internal name.

Solution is when you are promoting a field from infopath form , select that field modify it select the SiteColumn group and SiteColumn from dropdowns as shown in figure belw....


For Example: if you have created a column which exist in DSL Columns group select DSL Columns from drop down.

now select the name of field from Site Column and click ok

Do same steps for all promoted fields...if you have already created those fields in FormLibrary...

Check the Image below with screenshot highlighting points above ...


Tuesday, November 20, 2012

Create a content type with out Title Field

Scenario:-


Create a content type in SharePoint 2010 based on item content type but it should not have a title field.


Solution:-
1) Create an empty solution in visual studio 2010.

2) Add new item-> Content Type

3) Extend your content type from item content type.

4) now open the file and change inherits to False.



                 Name="ContentTypeName"
               Group="ContentType Group"
               Description="ContentType Description"
               Inherits="FALSE"
               Version="0">

Sunday, November 18, 2012

Set Default Value in People Picker Field

This post explains that how to set default value in people picker field in infopath 2010, i have picked current user in my example but it can be another field value on form, any function etc...
People picker field has
Display Name
AccountID
Account Type

in it....
you can set default values for each of these fields....
1) Add a people picker on infopath form
2) Take properties of any of above (sub fields) [I have picked Account ID in my example]
You can take properties by selecting AccountID in left hand field pan and right click, properties.
3) Set the default value for this as show in image below....
[i set it to current user, you can pick any other field value or function etc]