Client object Model managed Code C# SharePoint


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
namespace SPClient.NetConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ClientContext clientContext = new ClientContext(http://igtehydzbnv02:8811/);
            Web site = clientContext.Web;
            List list = site.Lists.GetByTitle(“TestListFilter”);
            CamlQuery query = newCamlQuery();
            ListItemCollection itemColl = list.GetItems(query);
            clientContext.Load(itemColl);
            clientContext.ExecuteQuery();
            Console.WriteLine(“Count: {0}”, itemColl.Count);
            for (int i = 0; i < itemColl.Count; i++)
            {
                Console.WriteLine(itemColl[i][“Title”]);
            }
            Console.ReadLine();
        }
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s