"Client" in the namespace. For example, in the server object model you have:
Microsoft.SharePoint.SPSite
Microsoft.SharePoint.SPWeb
Microsoft.SharePoint.SPList
In the client object model you have:
Microsoft.SharePoint.Client.Site
Microsoft.SharePoint.Client.Web
Microsoft.SharePoint.Client.List
NameSpace:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Example Code:
ClientContext context = new ClientContext("http://peakfinders.com");
List list = context.Web.Lists.GetByTitle("yourlistname");
CamlQuery query = new CamlQuery();
query.ViewXml = @"<View>
<Query>
<Where>
<Eq>
<FieldRef Name='Status'/>
<Value Type='Text'>Pending</Value>
</Eq>
</Where>
</Query>
</View>";
ListItemCollection listItems = list.GetItems(query);
context.Load(listItems, items => items.Include(
item => item["Name"],
item => item["Designation"],
item => item["Status"]
));
context.ExecuteQuery();
No comments:
Post a Comment