Hi ,,
Currently i am running with a issue that is..i want to retrieve sharepoint list items by using dotnet csom..but it throwing 404 unautherized error.
after giving system account credential also throwing same error..please anybosy help me out where i am going wrong
Below is my code
// ClientContext context = new ClientContext(HttpContext.Current.Request.Url);
using (ClientContext context = new ClientContext("http://najbsys2:16786/Holidays"))
{
context.Credentials = new NetworkCredential("naspadmin01", "Hello#!@#", "DC"); //naspadmin01(system account/Application pool admin)
List getitems = context.Web.Lists.GetByTitle("Expenses");
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);Expenses
ListItemCollection items = getitems.GetByQuerry(querry);
context.Load(items);
context.ExecuteQuery();
foreach (var item in items)
{
lblUrl.Text = item[""EmpNumber].ToString();
lblUrl.Text += Environment.NewLine;
}
}
please any body has any solution provide me
using (ClientContext context = new ClientContext("http://najbsys2:16786/Holidays"))
{
context.Credentials = new NetworkCredential("naspadmin01", "Hello#!@#", "DC"); //naspadmin01(system account/Application pool admin)
List getitems = context.Web.Lists.GetByTitle("Expenses");
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);Expenses
ListItemCollection items = getitems.GetByQuerry(querry);
context.Load(items);
context.ExecuteQuery();
foreach (var item in items)
{
lblUrl.Text = item[""EmpNumber].ToString();
lblUrl.Text += Environment.NewLine;
}
}
please any body has any solution provide me


Manesh GolekarRank #5,709 · 289 reputationPosted Jul 7, 2014, 3:03 PM EDT
can you try to load web object before List object creation
Manesh GolekarRank #5,709 · 289 reputationPosted Jul 7, 2014, 3:07 PM EDT
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/silverlight-webpart-in-share-point2010-using-client-object-model/
Hope this helps ..
thanks.
M
Cibun SwainRank #7,043 · 250 reputationPosted Jul 7, 2014, 8:50 PM EDT
Cibun SwainRank #7,043 · 250 reputationPosted Jul 7, 2014, 9:08 PM EDT
The applicationContext is not comming in normal visual wp if i am adding silverlight dlls then it showing conflicts on microsoft.sharepoint.client...
seeking more help from u to resolve my issue
Manesh GolekarRank #5,709 · 289 reputationPosted Jul 7, 2014, 9:14 PM EDT
Use code from that article and instead of ApplicationContext.current.url use your site URL string "http://najbsys2:16786/Holidays"
Cibun SwainRank #7,043 · 250 reputationPosted Jul 7, 2014, 9:36 PM EDT
Manesh GolekarRank #5,709 · 289 reputationPosted Jul 7, 2014, 9:41 PM EDT
Cibun SwainRank #7,043 · 250 reputationPosted Jul 7, 2014, 9:50 PM EDT
ClientContext clientContext = new ClientContext(siteUrl);
clientContext.Load(clientContext.Web);
clientContext.Credentials = new NetworkCredential("SHAREPOINT/system", "Hello#!@#", "DC");
List oList = clientContext.Web.Lists.GetByTitle("Expenses");
var querry = CamlQuery.CreateAllItemsQuery();
this.coll = oList.GetItems(querry);
clientContext.Load(coll);
// clientContext.ExecuteQuery();
clientContext.ExecuteQueryAsync(OnRequestSucceeded, null);
foreach (ListItem oListItem in this.coll)
{
lblUrl.Text = oListItem["EmployeeName"].ToString();
}
intellisense showing the error "Microsoft.sharepoint.client.clientcontext does not contain a method named ExecuteQueryAsync"
if i am using here only ExecuteQuerry then it showing unautherized error