Search This Blog

Thursday, October 28, 2010


RadioButtonList1.SelectedIndex = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByText("MyOption"))

Wednesday, October 13, 2010

Abstract vs Interface

An Interface cannot implement methods.
An abstract class can implement methods.

An Interface can only inherit from another Interface.
An abstract class can inherit from a class and one or more interfaces.

An Interface cannot contain fields.
An abstract class can contain fields.

An Interface can contain property definitions.
An abstract class can implement a property.

An Interface cannot contain constructors or destructors.
An abstract class can contain constructors or destructors.

An Interface can be inherited from by structures.
An abstract class cannot be inherited from by structures.

An Interface can support multiple inheritance.
An abstract class cannot support multiple inheritance.

Monday, October 11, 2010

JavaScript - MouseOver Image

< script language="javascript">

function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
function close_window()

< /script>

< a href="#"> < img src="../Images/sun-flower-white.jpg" onMouseOver="PopupCenter('../Images/sun-flower-white.jpg','test',500,500)" id="image1" width="200" height="150" alt="test" /> </a >

Friday, October 8, 2010

Sharepoint - GetListItems

public DataTable GetListItems()
SPSite spSite = new SPSite("http://larMOSS/properties/Lists/Property%20List/");

SPWeb spWeb = spSite.OpenWeb();

SPList spList = spWeb.Lists["Property List"];

DataTable dt = spList.Items.GetDataTable();

DataTable newdt;

if (dt != null)


DataView dv = new DataView(dt);

dv.RowFilter = "Status = 'Active'"; //condition like where clause

string[] st = { "Title", "Owner", "Status" };

newdt = dv.ToTable(False, st);

dt = null;

spList = null;

spWeb = null;

spSite = null;

return newdt;


Thursday, October 7, 2010

Sharepoint - SPSiteDataQuery

public static DataTable GetNames()
// retrieve the reference to the site where the Web part is on

SPWeb web = SPContext.Current.Web;

// retrieve all the different types of beers via a CAML query

SPSiteDataQuery qry = new SPSiteDataQuery();

qry.Query = "< OrderBy>
qry.ViewFields = "< FieldRef Name='Type' />";

qry.Lists = "< Lists ServerTemplate='100' />";

qry.Webs = "< Web Scope='Recursive' />";

// -- execute the query

DataTable dt = web.GetSiteData(qry);

return dt;


Validation - DropdwonList(

< script type="text/javascript">
function Validateddl(source, args) {
var str = TrimSpaces(args.Value);
if (str == "--Select--") {
args.IsValid = false;
args.IsValid = true;

< /script>

------ Example------------------------------------------------------------

< asp:DropDownList ID="ddlCreatorGroup" runat="server" CssClass="dropdown">
< /asp:DropDownList >
< asp:CustomValidator ID="CustoddmValidator2" ClientValidationFunction="Validateddl" Display="Dynamic" ControlToValidate="ddlCreatorGroup" runat="server"
ErrorMessage="Please select creator group"> < /asp:CustomValidator >

c# - MulitDimensionla Array With Foreach

Example with a Rectangular Array

The following example shows the foreach statement used with a rectangular array:

class Sample
static void Main()

int nTotal = 0;
int[,] arr1 = { {10, 11}, {12, 13} };

foreach( int element in arr1 )
nTotal += element;

("Element: {0}, Current Total: {1}",
element, nTotal);

The output is the following:

Element: 10, Current Total: 10

Element: 11, Current Total: 21

Element: 12, Current Total: 33

Element: 13, Current Total: 46

C#-Working with Arrays in .NET


This tutorial is divided into the following sections:

  • Arrays in General
  • Declaring Arrays
  • Initializing Arrays
  • Accessing Array Members
  • Arrays are Objects
  • Using foreach with Arrays

Arrays in General

C# arrays are zero indexed; that is, the array indexes start at zero. Arrays in C# work similarly to how arrays work in most other popular languages There are, however, a few differences that you should be aware of.

When declaring an array, the square brackets ([]) must come after the type, not the identifier. Placing the brackets after the identifier is not legal syntax in C#.

int[] table; // not int table[];  

Another detail is that the size of the array is not part of its type as it is in the C language. This allows you to declare an array and assign any array of int objects to it, regardless of the array's length.

int[] numbers; // declare numbers as an int array of any size
numbers = new int[10]; // numbers is a 10-element array
numbers = new int[20]; // now it's a 20-element array

Declaring Arrays

C# supports single-dimensional arrays, multidimensional arrays (rectangular arrays), and array-of-arrays (jagged arrays). The following examples show how to declare different kinds of arrays:

Single-dimensional arrays:

int[] numbers;

Multidimensional arrays:

string[,] names;

Array-of-arrays (jagged):

byte[][] scores;

Declaring them (as shown above) does not actually create the arrays. In C#, arrays are objects (discussed later in this tutorial) and must be instantiated. The following examples show how to create arrays:

Single-dimensional arrays:

int[] numbers = new int[5];

Multidimensional arrays:

string[,] names = new string[5,4];

Array-of-arrays (jagged):

byte[][] scores = new byte[5][];
for (int x = 0; x < scores.Length; x++)
scores[x] = new byte[4];

You can also have larger arrays. For example, you can have a three-dimensional rectangular array:

int[,,] buttons = new int[4,5,3];

You can even mix rectangular and jagged arrays. For example, the following code declares a single-dimensional array of three-dimensional arrays of two-dimensional arrays of type int:

int[][,,][,] numbers;


The following is a complete C# program that declares and instantiates arrays as discussed above.

// arrays.cs
using System;
class DeclareArraysSample
public static void Main()
// Single-dimensional array
int[] numbers = new int[5];

// Multidimensional array
string[,] names = new string[5,4];

// Array-of-arrays (jagged array)
byte[][] scores = new byte[5][];

// Create the jagged array
for (int i = 0; i < scores.Length; i++)
scores[i] = new byte[i+3];

// Print length of each row
for (int i = 0; i < scores.Length; i++)
Console.WriteLine("Length of row {0} is {1}", i, scores[i].Length);


Length of row 0 is 3
Length of row 1 is 4
Length of row 2 is 5
Length of row 3 is 6
Length of row 4 is 7

Initializing Arrays

C# provides simple and straightforward ways to initialize arrays at declaration time by enclosing the initial values in curly braces ({}). The following examples show different ways to initialize different kinds of arrays.

Note   If you do not initialize an array at the time of declaration, the array members are automatically initialized to the default initial value for the array type. Also, if you declare the array as a field of a type, it will be set to the default value null when you instantiate the type.

Single-Dimensional Array

int[] numbers = new int[5] {1, 2, 3, 4, 5};
string[] names = new string[3] {"Matt", "Joanne", "Robert"};

You can omit the size of the array, like this:

int[] numbers = new int[] {1, 2, 3, 4, 5};
string[] names = new string[] {"Matt", "Joanne", "Robert"};

You can also omit the newoperator if an initializer is provided, like this:

int[] numbers = {1, 2, 3, 4, 5};
string[] names = {"Matt", "Joanne", "Robert"};

Multidimensional Array

int[,] numbers = new int[3, 2] { {1, 2}, {3, 4}, {5, 6} };
string[,] siblings = new string[2, 2] { {"Mike","Amy"}, {"Mary","Albert"} };

You can omit the size of the array, like this:

int[,] numbers = new int[,] { {1, 2}, {3, 4}, {5, 6} };
string[,] siblings = new string[,] { {"Mike","Amy"}, {"Mary","Albert"} };

You can also omit the newoperator if an initializer is provided, like this:

int[,] numbers = { {1, 2}, {3, 4}, {5, 6} };
string[,] siblings = { {"Mike", "Amy"}, {"Mary", "Albert"} };

Jagged Array (Array-of-Arrays)

You can initialize jagged arrays like this example:

int[][] numbers = new int[2][] { new int[] {2,3,4}, new int[] {5,6,7,8,9} };

You can also omit the size of the first array, like this:

int[][] numbers = new int[][] { new int[] {2,3,4}, new int[] {5,6,7,8,9} };


int[][] numbers = { new int[] {2,3,4}, new int[] {5,6,7,8,9} };

Notice that there is no initialization syntax for the elements of a jagged array.

Accessing Array Members

Accessing array members is straightforward and similar to how you access array members in C/C++. For example, the following code creates an array called numbers and then assigns a 5 to the fifth element of the array:

int[] numbers = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
numbers[4] = 5;

The following code declares a multidimensional array and assigns 5 to the member located at [1, 1]:

int[,] numbers = { {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10} };
numbers[1, 1] = 5;

The following is a declaration of a single-dimension jagged array that contains two elements. The first element is an array of two integers, and the second is an array of three integers:

int[][] numbers = new int[][] { new int[] {1, 2}, new int[] {3, 4, 5}

The following statements assign 58 to the first element of the first array and 667 to the second element of the second array:

numbers[0][0] = 58;
numbers[1][1] = 667;

Arrays are Objects

In C#, arrays are actually objects. System.Array is the abstract base type of all array types. You can use the properties, and other class members, that System.Array has. An example of this would be using the Lengthproperty to get the length of an array. The following code assigns the length of the numbers array, which is 5, to a variable called LengthOfNumbers:

int[] numbers = {1, 2, 3, 4, 5};
int LengthOfNumbers = numbers.Length;

The System.Array class provides many other useful methods/properties, such as methods for sorting, searching, and copying arrays.

Using foreach on Arrays

C# also provides the foreach statement. This statement provides a simple, clean way to iterate through the elements of an array. For example, the following code creates an array called numbers and iterates through it with the foreach statement:

int[] numbers = {4, 5, 6, 1, 2, 3, -2, -1, 0};
foreach (int i in numbers)

With multidimensional arrays, you can use the same method to iterate through the elements, for example:

int[,] numbers = new int[3, 2] {{9, 99}, {3, 33}, {5, 55}};
foreach(int i in numbers)
Console.Write("{0} ", i);

The output of this example is:

9 99 3 33 5 55

However, with multidimensional arrays, using a nested for loop gives you more control over the array elements.

Wednesday, October 6, 2010

Sharepoint -How to get Data from Active Directory using C#

How to get Data from Active Directory using C#
Today, I am going to discuss how to fetch data from active directory and how to store it into a clas..
We can access LDAP or AD by using two class: DirectoryEntry and DirectorySearcher
Step 1:

Add reference to System.DirectoryServices amd import it in the code by entering using System.DirectoryServices;
Step 2:
We need the AD Location, AD Userid and AD Password in order to read data from it.

We store these values in web.config:
< appSettings>
< add key="GaadLocation" value="LDAP://XXXXX:XXX"/>
< add key="GaadUserName" value="XXXXXX"/>
< add key="GaadPassword" value="XXXXXX"/>
< /appSettings>

Step 3:
In order to store the data fetched from AD, we created a class and defined some properties.

public class ADContact
public string UniqueId {get; set; }
public string LastName { get; set; }
public string DepartmentNumber { get; set; }
public string EmployeeType { get; set; }
public string TelephoneNumber { get; set; }
public string FirstName { get; set; }
public string UserStatus { get; set; }
public string Mail { get; set; }
public string Mobile { get; set; }
public string Title {get; set; }

Step 4: Create a method that will return a datatable so that we can iterate through the result.

public List GetADContacts(string SirName, string GivenName, string UniqueId)

Step 5:

Within the method, create a SearchResultCollection object , a datatable, and list of AD properties to access:

SearchResultCollection results = null;
List GaadData = new List();

string ADLocation, ADUserId, ADUserPassword = string.Empty;
#region List of AD Properties
string[] properties = new string[]

Step 6:
Declare a try-catch block and within try- write the following code:
try {
string strfilter = string.Empty;

//Get AD Settings from web.config
ADLocation = ConfigurationManager.AppSettings["ADLocation"];
ADUserId = ConfigurationManager.AppSettings["ADUserName"];
ADUserPassword = ConfigurationManager.AppSettings["ADPassword"];

//Create an instance of DirectoryEntry by passing the setting valies)
DirectoryEntry root = new DirectoryEntry(ADLocation, ADUserId, ADUserPassword, AuthenticationTypes.FastBind);

//Create the filter string : we need to search the Ad for people matching the search criteria. Here we are passing three parameters: SirName, GivenName, Uid. If any field is blank, we are putting * there. that is to get all values

strfilter = String.Format(
String.IsNullOrEmpty(SirName) ? "*" : SirName + "*",
String.IsNullOrEmpty(GivenName) ? "*" : GivenName + "*",
String.IsNullOrEmpty(UniqueId) ? "*" : UniqueId + "*");

if (strfilter != "")
DirectorySearcher searcher = new DirectorySearcher(root, strfilter, properties);
searcher.Asynchronous = true;
searcher.SearchScope = SearchScope.Subtree;
results = searcher.FindAll();
foreach (SearchResult result in results)
ADContact contact = new ADContact();

if (result.Properties["uid"].Count > 0)
contact.UniqueId= Convert.ToString(result.Properties["uid"][0]);

if (result.Properties["title"].Count > 0)
contact.Title = Convert.ToString(result.Properties["title"][0]);

if (result.Properties["sn"].Count > 0)
contact.LastName = Convert.ToString(result.Properties["sn"][0]);

if (result.Properties["givenName"].Count > 0)
contact.FirstName = Convert.ToString(result.Properties["givenName"][0]);

if (result.Properties["facsimileTelephoneNumber"].Count > 0)
contact.TelephoneNumber = Convert.ToString(result.Properties["facsimileTelephoneNumber"][0]);

if (result.Properties["mobile"].Count > 0)
contact.Mobile = Convert.ToString(result.Properties["mobile"][0]);

if (result.Properties["mail"].Count > 0)
contact.Mail = Convert.ToString(result.Properties["mail"][0]);

return ADData;
catch (Exception ex)
throw ex;


01. Tell me about your education background, work profile.
02. Is dot net object oriented?
Here I said 'YES' next question

Lets start with OOPS
03. What is an abstract class?
04. What is an interface?
05. What is the difference between abstract class and an interface?
06. When to use what (abstract/interface)?
07. Give practical scenario regarding usage.
08. What is the relation between virtual and override keyword?
09. What is Polymorphism?
10. What is method overloading and method overriding?
11. What is singleton class?
12. When to use singleton class?
13. Any class in dot net framework that is an example of singleton class?
14. What is inheritance?

You have worked on SharePoint also....YES
SharePoint coding or just Out-Of-Box? ... Coding

15. What is a web part?
16. Advantage of web part?
17. How to deploy a web part..step by step
18. What is the command line utility used in SharePoint?
19. How you can implement List Item listener?
20. Scenario: You need to check before inserting an item to list that whether the EmpID( field) is unique or not? How will you implement?
21. How will you deploy a feature?

22. What is an index?
23. How many types of index are there?
24. How many index I can have on a table? Any max limit?
25. What is difference between a primary key and unique key?
26. What are constraints?
27. Name any constraint?
28. Scenario: Table: EMPID, EMPDEPT, SALARY. You need to restrict that one can insert a row where salary is less than 5000. How will you implement that?
29. What is trigger and of how many types?
30. Have you worked on cursors?..I said no..that's why no further questions

--------DOT NET-----------
31. What are attributes in dot net?
32. Can we define user defined attributes?..IF yes then How?
33. How web service communicates between two non-compatible platforms?
34. Can web service preserve state? How?
35. What is singleton web service?
36. When we add a class file, what remains the default assess modifier?
37. Difference between protected internal, protected ?
38. What is MVC?
39. How will you relate MVC with 3-tier architecture?

-------Process Oriented----------
40. Can you name and explain any design pattern with example
41. Have you ever used any defect analysis?
42. What type of proceed flow you use?
43. Have you ever designed design document?
44. What are the main parts of a design document?
45. What tool you used in order to draw class diagrams?
46. Any idea regarding UML?

Sharepoint -Check SPGroup

public bool isGroupExist(string groupName)
SPSite _objSite;
SPWeb _objWeb;
bool flag = true;
string _siteUrl = SPContext.Current.Site.Url;
using (_objSite = new SPSite(_siteUrl))
using (_objWeb = _objSite.OpenWeb())
if (_objWeb.SiteGroups.Cast().Any(g => string.Compare(g.Name, groupName, true) == 0))
flag = false;

}); return flag;

Sharepoint - update SPGroupName

using (SPWeb oWebsite = SPContext.Current.Site.RootWeb)
SPGroup oGroup = oWebsite.SiteGroups["Original_Name"];
oGroup.Name = "New_Name";
oGroup.Owner = oWebsite.Users["Domain_Name\\User"];
oGroup.Description = "Description";

Monday, October 4, 2010

How to Create Custom SharePoint Groups from Features

How to Create Custom SharePoint Groups from Features

While developing SharePoint Features, you may want to create a Custom SharePoint Group as part of the feature. Some common scenarios might include:

* features that create workflows requiring specific groups for approvers

* features that create custom libraries or list which only specific users(groups) should be able to access

* features with custom application pages that provide specific functionality based on group membership

The list goes on and on; and while you could let the site owners create these groups and assign the necessary permissions (for most of these scenarios); wouldn't it be safer if this was done by you. Think of all the time you'll save on calls where you would otherwise have to explain how to do this, or troubleshooting where they've gone wrong. True, they'll still have to add the users to the groups; but if they cant even do that maybe their place shouldn't be anywhere near SharePoint.

In this posting I hope to demonstrate just how to do this by developing a feature that creates a Custom Group when activated.

We'll begin by creating a folder called "CustomGroup" in the SharePoint feature directory (ie. "c:\program files\common files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATUES\CustomGroup")

Next we'll create the FEATURE.xml file, it should look as follows:

Description="This Feature Creates a Custom Group"
ReceiverAssembly="CustomGroupFeature, Version=,
Culture=neutral, PublicKeyToken=TBD"

Notice the ResourceAssembly and ReceiverClass attributes. These serve as references to the assembly that will handle the FeatureActivated, FeatureDeactivating, FeatureInstalled and FeatureUninstalling events. The PublicKeyToken of the ReceiverAssembly attribute has been set to TBD, we wont have this until we've created and compiled the class.

Next we'll create the SPFeatureReceiver class referenced above. Your code should look as follows:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace CustomGroupFeature
class FeatureReceiver : SPFeatureReceiver
public override void FeatureActivated(SPFeatureReceiverProperties properties)
//get a reference to the site collection where the feature is activated
using (SPSite site = properties.Feature.Parent as SPSite)
//get a reference to the root site / web of the site collection
using (SPWeb web = site.RootWeb)
//get a reference to a Site Owner
//(there should always be at least 1; position 0 of the
//Administrators UserCollection)
//we'll make this user the owner of the custom group
SPMember siteOwner = web.SiteAdministrators[0];

//prepare the group name
string grpName = "Custom Group";

//check if group exists
bool grpExists = false;

foreach (SPGroup group in web.SiteGroups)
if (group.Name.ToLower() == grpName.ToLower())
grpExists = true;

//add the custom group to the site
//if it doesnt allready exist
if (!grpExists)
web.SiteGroups.Add(grpName, siteOwner, null,
"Custom Group that I created because I can!");

//get a reference to the group we just created
SPGroup customGroup = web.SiteGroups[grpName];

//add the group to the quicklaunch
web.Properties["vti_associategroups"] =
web.Properties["vti_associategroups"] + ";"
+ customGroup.ID.ToString();

//.....FeatureDeactivating, FeatureInstalled, and FeatureUninstalling methods

The code has enough comments to be self explanatory. Make sure you create your class under the right namespace, as this is referenced in the FEATURE.xml file. You'll also need to sign the assembly (give it a strong name), go to for step-by-step instructions on how to do this.

Compile the assembly and add it to the GAC. While in the GAC,right click the assembly, select properties and make a note of the Public Key Token. You'll need to update it on the FEATURE.xml file.

Deploy your feature via the Installfeature command in STSADM or by packaging it and deploying it in a WSP file.

Since we've set the scope of the feature to "Site"; you'll have to activate your feature from the "Site Collection Features" link on the Site Settings page. If you are on a sub-site/web you'll need to click on the "Go to top level site settings" link first.

Friday, October 1, 2010

InfoPath-Publish your InfoPath form to SharePoint Example

How to... Publish your InfoPath form to SharePoint – A series of Forms and SharePoint-ing
In this article I’d like to introduce you to the basics of a step by step approach to publishing your InfoPath forms to SharePoint – it is intended for entry users.

First things first – your environment configuration

Windows Server 2008 SE

Office SharePoint 2007 (SP1) 

Microsoft SQL Server 2005 (SP2) 

Microsoft Office InfoPath 2007 (Office 2007 SP1)

A quick overview

We are trying to establish here is to create an InfoPath HR form that will opened as a template from a library within a web browser and then submitting to the forms library with the form fields as library columns. The XSN form will be a custom content type.


Let’s start off by configuring our SharePoint list and environment before we get into the InfoPath form. I will ultimately create two form libraries. One will house my XSN and the other is the library I will have all new forms submitted to.

1) Create a new SharePoint site [Site Actions, Create Site]

2) Now we need to create a Form Library to store my source XSN files, I’ve called mine “Source InfoPath Forms”. The reason is to secure my source library and allow a group of authors that can change or create new InfoPath Forms.

3) I’ll create another Forms Library with the same settings above and call it “Human Resources Recruits”.

4) Then configure the “Human Resources Recruits” library settings

a. Open the Human Resources Recruits library click Settings | Form Library Settings

b. Now click on Advanced settings found under General Settings
c. Make sure you change the option to allow management of contents type to Yes. This will allow you to create a library content type from your InfoPath Form.

d. Also make sure your Browser enabled Documents are set to Open as a Web Page. You’ll want your new forms to open in the browser. Remember that InfoPath form services don’t require you end-users to have the InfoPath client installed on their workstations.

5) Before we continue, I’d like to bring your attention to the default columns for the Human Resources Recruits library:

We’ll publish additional columns from InfoPath a little later.

6) Great. We have now created the two libraries and configured SharePoint to get our solution off the ground. Next, we’ll dive into InfoPath. So this is a good time to open up your Microsoft InfoPath 2007 client on your computer.

7) From the “Getting Started” window in InfoPath, click on “Design a Form Template”, then use the “Blank” form template and ensure you tick the “Enable Browser-compatible features only” check box.

InfoPath offers many rich client side features that you can add to your forms. However, we are requesting SharePoint and the Forms server to do its magic and hence, have some features are disabled for the browser functionality.


8) I’ve created a very basic form with a couple of fields that my HR Manager will need to complete for the interview process using the controls. I’ve saved my form as the HRRecruitsTemplate.xsn (download it here if you wish).

9) Now for the publishing part. From InfoPath, click on “Tools”, “Submit Options” and configure the submit options as below: 



Before clicking OK, we need to setup a data connection. My Document library is the library I will store all new recruits forms. Now I’m using the InfoPath form to capture the “metatdata” for my library so my filename will be simple as I’m going to use grouping options in SharePoint to configure my library according to my users needs. Ie. A different view for the Senior Manager and another for the Recruitment Officer who completes these forms.

You’ll also notice that my URL to the library


Click “Next” and provide a name for this data source.

Click “Ok” on the “Submit Options” window.

10) Cool – so now we have setup the location to where all submitted forms will go.

11) Now let’s configure some “Form Options” before we publish. Again, click “Tools” on your menu and “Form Options”

12) Under the “Browser” Category, I’ve selected to show my InfoPath Services toolbar on the top of the page as well as the bottom. I also only need “Submit” and “Close” for the purposes of this form. I don’t need save options as I’ve already configured the format of my name when a user submits the form.

13) Next, I’m going to extend some fields that I defined in the form to the SharePoint columns as “Property Promotions”.

You’ll find I’ve added a few fields I’d like to map to SharePoint (you can also do this process when you’re publishing your form later in this article).

14) Finally, we’re ready to publish this form to SharePoint. Click on “File” and “Publish”

We’re now presented with the “Publishing Wizard”. Select “To a SharePoint server with or without InfoPath Forms Services”. Remember earlier, we created another library where i called mine “Source InfoPath Forms”. This is where we going to publish our source to.

Click “Next” and input the location of our SharePoint or InfoPath Forms Services site.

Mine is

Click “Next”

15) I’ve already prepared my SharePoint library to allow “Management of Content types” in an earlier step, so now I have the ability to publish my Form as a Site Content Type. The advantages of this is I have the columns in the SharePoint library as promoted fields – so I can start to get inventive around my grouping and sorting, perhaps some calculations etc. Maybe apply a workflow to the Content Type “HR Recruitment Form” – these options are all available.

Click “Next”

16) In the next step of the wizard, we are asked if we want to create this as new or update. Since this is our first version of the form – I recommend “Create a new content type”. Any iterations of the form you can use the “update” function.

Click “Next” and give your content type and “Name” and “Description” and click “Next”.

17) The wizard will request a location and name for the form template. I’m going to keep my XSN templates in the Source location on SharePoint and Here is my location and name: http://marclenferna/sandbox/Source%20InfoPath%20Forms/HRRecruitsTemplate.xsn.

Click “Next”

18) (We’re getting close) Next, we have our form Property fields that will be available in SharePoint as columns. You can click “Next” here as we’ve already set them up earlier.

19) Finally a verification screen some our settings:

Click “Publish” – Finally 

It will now save your InfoPath XSN file, create the content type, configure our destination library in SharePoint

20) Navigate to our Source InfoPath Forms library. Voila – we have our XSN form. Its not at all needed for our Form Content Type to work but a super place to keep all your forms together. 

21) Now back to the “Human Resource Recruits” library. Notice that there is a new form Content Type when you click the drop down arrow next to “New”

Pretty neat huh! Ok – so let’s do some housekeeping and polish this library up.

22) Click “Settings” and “Form Library Settings” and notice a whole new bunch of new Columns available – all from the InfoPath form we published as a Content Type. Remember this is a site content type and can be found along with your other site content types. All CType features and settings apply! So add a workflow associated to this content type is also possible.

23) Back to the Forms Library Settings

I’ll remove the Content Type labelled “Form”, click on Change new button order and default content type; I unchecked Form as a visible content type.

I’ll also modify the “All Documents” view to group according to Interview Date Surname, I’ve added some of the column fields to the view, structured some totalling to get the view similar to the diagram below:

So my library looks like this:

Click the Candidate Recruitment Interview and you presented with our InfoPath web form.

After we submit a form, we get a Thanks popup that essentially means we’re good and our item is captured into the library.

With a bit of data population, you get:


Thats it folks. Oh by the way, you could embed that form in Office Outlook or as an attachment and still have users click the submit button and populate your SharePoint list. So web, email or file share. All works!

Happy SharePointing, Forms Services, InfoPathing :)