Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.GetResponse()

$
0
0

Hi to all ,

In auto-hosted apps i added custom list without code using feature ,now i deploy that apps in online sharepoint site 2013. Now i want to fetch item from that list using CSOM in Clienthost web part than i got the error and error is

System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.GetResponse() and following code i am using for fetching the data from list

 ClientContext clientContext = new ClientContext("https://snapchamp-d4fb71a65ae947.sharepoint.com/");
                Web web = clientContext.Web;
                List list = web.Lists.GetByTitle("TOD");
                CamlQuery query = CamlQuery.CreateAllItemsQuery();
                Microsoft.SharePoint.Client.ListItemCollection itemcoll = list.GetItems(query);
               
                clientContext.Load(itemcoll);
                clientContext.ExecuteQuery();

foreach (Microsoft.Sahrepoint.client.ListItem item in itemColl)
{
// Display the item title field value
Label1.Text = item["Title"].ToString();
}


Viewing all articles
Browse latest Browse all 8089

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>