Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 Sharepoint
Hi,
How to get all items in list from sharepoint List using c#. Please Help me to solve this problem.

I am write code this code but its get only list item count.try to get list items but not working.
 
ClientContext context = new ClientContext("http://sezdmc445//_vti_bin/lists.asmx");
NetworkCredential cred = new NetworkCredential();
cred.UserName = "spadmin";
cred.Password = "abc@1234";
//context.UseDefaultCredentials = false;
context.Credentials = cred;
context.Load(context.Web);
context.Load(context.Web.Lists);         
context.ExecuteQuery();
Web web = context.Web;
ListCollection lists = context.Web.Lists;       
string abc = "DL_ABCD";
foreach (List list in lists)
{
    if (list.Title ==  abc )
    {
        string lisiitem12 = list.ItemCount.ToString();           
        MessageBox.Show(lisiitem12);
        MessageBox.Show(list.Title);        
    }
}
Posted 2-May-13 3:55am
Edited 3-May-13 0:14am
v5
Comments
Sandeep Mewara at 2-May-13 9:51am
   
What have you tried so far?
lukeer at 3-May-13 2:48am
   
What exactly is not working?
Do you get any error messages?
Can you narrow down what code line causes the error?
 
Nothing to do with your question, but you construct a StringBuilder instance using string concatenation. That's what the use of StringBuilder usually is there to prevent. Do you use it more afterwards?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 George Jonsson 145
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 3 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100