.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to read sharepoint list attributes?

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint

Hi, I need to fetch the attributes of a specific list from sharepoint using C#.

using(SPSite site = new SPSite("http://sharepointsite/"))
    using(SPWeb web = site.OpenWeb())
       SPListCollection listCollection = web.Lists;
       foreach (SPList list in listCollection)

The above code fetch me the sharepoint lists.

Now my requirement is, to fetch the attributes of specific list. For example, "Tasks" is a list and when we create a new task, it will ask various attributes such as, "Title, priority, assigned to, status, description etc". I need to get this list of attributes and update the property grid with these attributes. How can I achieve this?


View Complete Post

More Related Resource Links

How to read a column of a sharepoint list to a text string field of infopath form?

My infopath form used to read these email addresses from a web service and web.config file. Now i would like to get these user email addresses from a contact list in a sharepoint server. I am trying to do this without writing any codes. Here is what i have done so far: 1. Adding a new "data connection to receive data from SharePoint library or List" where i selected Email Address column of the contact list. 2. I added a new Text Field and define a new rule with "Query using a data connection" defined above. When i try to access the newly created Text field above it always return empty as if the Query attached to it did not executed at all. What did i do wrong? Is there a better way? Thank you in advance for your help.

Read data from BLOB field and write to sharepoint list

Hi, I want to read the data from BLOB field and write it into sharepoint list item. Please provide some pointer to archive above objective.   Thanks in Advance.

Read list of a sharepoint site

I have to read a list of a sharepoint site from a client who does not has sharepoint installed. The problem is that when I try to use the SPSite tell me http://Sharepoint/sites/Sitio2/default.aspx could not be found. Tks!!!

Error creating Read Item or Read List operation in Sharepoint Designer 2010

In terms of high-level requirements, I need to pull in lists from a couple of different web apps.  To do this, I’m using SPD 2010 to create an External Content Type for the list of interest.  I’m able to create a SOAP Service or WCF Service connection just fine.  However, when I try to create the external content type and create a Read Item Operation on one of the GetList or any other Get* (or other Update methods for that matter) methods, I get the following error:"The method that your operation is based on has parameters with complex types that do not have default parameterless constructor.  This kind of data source methods cannot be used in Business Data Catalog."I tried defining an operation on the “AddAttachment” method, and that worked just fine.  I also tried providing default values to the listName and viewName parameters when creating the SOAP Service connection, but still get the error.  Same issue with a WCF Service connection as well. Does anyone know if this is a 2010 issue, or am I approaching this requirement incorrectly?  What are other approaches for connecting to lists that reside in a different web app than yours? 

How to read Email Received to a SharePoint List

I have a email enabled Sharepoint list which can receive email. i am trying to write an evenhandler for the spemailreceiver class where i have to read the Email Body Content and grab some elements from that email body not the whole Body Content and add it to the List Field. IF the Body Content is : Name: John LastName:Johny i have to read John and Johny and populate it to a Neew List item with their fields Name= John and LastName= Johny. any ideas of reading the email body and grabbing the needed elements from it.....

read and print sharepoint list information using javascript



i am working on a form right now, user's inputs will be stored in a sharepoint list. after user click submit, it will display a thankyou panel, and send a email to me showing user's input. on the thankyou panel, there is a button, if user click it, it will open a new window and display exactly the same thing in email, so that user can check if they input the right thing.

i did this part using javascript, the window.open method. and i wrote html code in it, using window.document.write method.

i wrote a read from sharepoint list function, i dont know if it is working, but my question is how can i call this function in javascript since it will be a client side programming.

my readfromlist code is here:

public void readFromList()
             SPSite oSiteCollection = SPContext.Current.Site;
             SPList oList = oSiteCollection.AllWebs["something"].Lists["somelist"];
             SPView oListView = oList.Views["All Items"];
             SPListItemCollection collectListItems = oList.GetItems(oListView);

             foreach (SPListItem oListItem in collectListItems)
                 txtFirstName.Text = SPEncode.HtmlEncode(oListItem["First Name"].ToString()) + "<BR>";

On excel sheet upload read the workbook and populate data to sharepoint list


Requirement in my current project:
In a document library when I upload an excel sheet, a specific workbook has to be read and the contents have to be uploaded to a sharepoint custom list.
The approach followed was create an event receiver and register as a feature. Following is the code for event receiver.

public override void ItemAdded(SPItemEventProperties properties)
            var list = getSPList("{150301BF-D0BD-452C-90D7-2D6CD082A247}");          
            SPListItem doc = properties.ListItem;
            doc["Msg"] = "items deleted from req list";
            string excelname=doc.File.Name;

How to read a NULL value sharepoint list item


hi guys,

im having trouble pulling some specific information out from sharepoint list item. im doing a asp.net form and saved all user inputs into sharepoint list. if all information are there, my code works fine, if some colume is missing(the scenera requires to do that), it will return a  System.NullReferenceException: Object reference not set to an instance of an object exception. How can i read a null item, and maybe simply assign it to a string such as "NO VALUE", something like that?

i've tried all methods that i can think about, such as system.DBNull.value, or string.empty, or just null.

code is here: this is the save to list code:

private void SaveToTTCVIPList(SPWeb web)
        TTCVIPList = web.Lists["TTCVIP"];
        TTCVIPList = AddList(web, "TTCVIP", "List for TTCVIP user's information", "Custom List", true);
      SPListItem item = TTCVIPList.Items.Add();      
if (this.txtJointHolderName.Text == System.DBNull.Value)
        item["Joint Holder Name"] = string.Empty;

How to read value of Column under list using Sharepoint 2007



I am new to Sharepoint so please bear with me even if i ask for small clarifications.

I want to read the List using Powershell from Sharepoint Site.

Output i want to display is all columns that are under the Sharepoint List.


I have created a Sharepoint Web Application, Then i created the Sharepoint site Collection, then i created a new List named Employee List under Site Collection.

The Columns under that List are:

Empno,Empname and Salary.

I want to display the value of all the columns using the Powershell Script.

I am using the below Script.

 $list=$OpenWeb1.Lists["Employee List"]
 if($test -eq $null)
 Write-Host Site does not exist
 for($l=$listItemsTotal-1;$l -ge 0;$l--)
 Write-Host $listItems[$l].name

Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

How to add custom list entries to mysite's calendar in Sharepoint 2007 site?


I would like to know below things

(1) How to create MySite for one specific member with other or administrator's access?

(2) Scenario : Administrator have created one SP2007 site. now Administrator have created one calendar (Sample calendar). Administrator have added some entries in calendar. now one user entered in portal site ansd view the calendar and he click on MySite menu. so this sample calendar entries should enter in that user's mysite calendar. How this can be achieved?

Thanks in advance.
Regards, Praful Udade

Sharepoint Blog Post List Renaming in onet.xml


Ihave created a Site definition and added a Posts Listview in the same.

<View List="$Resources:core,lists_Folder;/$Resources:core,blogpost_Folder;" BaseViewID="10" WebPartZoneID="Left" WebPartOrder="1"/>

This list is created using my own schema.xml which i have copied from the Blog site template.

I wanted to rename the title of the list [not Title field] which is coming to be Posts right now.

Is there anyway to do it?

Any help appreciated


Is there a list of the Accessibility Acts that SharePoint supports?



 Is there a list of accessibility acts that SharePoint 2007 supports.
 For example the Accessibility for Ontarians with Disabilities Act, 2005?


Thank You

Sarbjit Gill

How to join two sharepoint list in c# by CAML query?

Hii All,
   I am using wss 3.0 and i have one site and site has 4 to 5 lists. lists are interconnected with lookup column and same column. I need to display some column fron one list and some from another.. i need to join that lists by where condition like project =project..

So how can i join??

Thank You

Trying to send email using Sharepoint Designer 2007 workflow and email enabled list


I have a a list that recieves email. I have few fields that shows me the originator: "E-Mail From" and "E-Mail Sender".

I am trying to create a workflow that will generate an auto reply to the originator but the SPD fails to recognize the email address in these two fields. It's either truncating part of it or uses the html ( href=mailto:Demo@DemoSomething.com) in the To field.

Thank you,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend