Raghu's SharePoint Column : SharePoint - My Lifeline!!

Raghu's SharePoint Column

How To Create List Programmatically using Custom List Template (OOB)

How To Create List Programmatically using Custom List Template (OOB)

There are many ways to create a list as follows
1. Creating list Using OOB UI.
2. Creating list Using List Templates
3. Creating list Using Features
4. Creating list programmatically or by a code behind approach

Programmatically a list can be created by writing a console application or by creating exe. The advantage of creating list programmatically will also help you tp retain lookup column in the same list or some other list. I will be discussing regarding lookup column in my next article
This article is written to create a list using out of the box (OOB) custom list template using a code behind approach.The snippet belows shows how to create a list.

 using (SPSite site = new SPSite("siteurl”))
 SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates = true;
 Console.WriteLine("Creating Menu List..");
 Guid listGuid = web.Lists.Add("ListName”, "Menu Contents For Intranet", SPListTemplateType.GenericList);
Console.WriteLine("List Created...");</span>

The SPListTemplateType has all the OOB cusotm list template such has Announcements, Tasks, Comments etc. The GenericList is a custom list template which I have used in my code


dont forget to add web.AllowUnSafeUpdate = false;

If the form uses any references that are at the pblhisued URL, it will try and connect, otherwise, the forms most likely will just check to see if there is an update that the user should download. There should be an option in the client that will avoid checking for an update for forms. If you are using a sharepoint list or something along those lines, you can use the option on setting up the data connection to cache data content. Hope this helps some.

This is actually more of a qutieson than a comment. I have had your problem (with forms) . But then i switched to another solution in mind: i am now trying to attach the form and send it from the workflow.. have you been able to do that? (the thing is, sharepoint designer 2007 blogs are still very scarce!!!!).. so any help is appreciated. Thanks man.

Leave a Reply

Protected by WP Anti Spam