Saturday, February 26, 2011

Show list details in SharePoint

In SharePoint the lists and libraries are main parts. To get the list details regarding the list title and the list description there are predefined properties are created by the the SharePoint developers. I was implemented the following code in visual studio console application before using that you need to have the SharePoint  reference. You can get this by installing SharePoint(moss) in your computer. In my previous post i was explained clearly how to install the MOSS click here to check the post.

code to get  list details.
// Get the list details
public static void GetListDetails(SpWeb currentWeb)
{
SpList list=currentWeb.lists["Calendar"];//calendar is the list name
if (list != null)
{
  Console.WriteLine("Title:{0}\n Description:{1}", list.Title
                            ,  list.Description);
}
else
{
  Console.WriteLine("list is not exists");
}
}
Here we are passing the SpWeb object and through that we are getting the SpList Object using list collection in the list.

Hope this will help will you.

Share this

0 Comment to "Show list details in SharePoint"

Post a Comment