Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
C# to retrieve list items from sharePoint online
I have console application running on my local machine, got error "System.Net.WebException: 'The remote server returned an error:(403) Forbidden.' " when executed below code Below code is working fine for SharePoint server sites but not for SharePoint online sites.
var webUrl = new Uri("https://SharePointOnline123.com");
using (ClientContext ctx = new ClientContext(webUrl))
{
Web webObj = ctx.Web;
List listObj = webObj.Lists.GetByTitle("AbcList");
CamlQuery cqObj = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection colObj = listObj.GetItems(cqObj);
ctx.Load(colObj);
ctx.ExecuteQuery();
if (colObj.Count != 0)
{
foreach (ListItem item in colObj)
{
Console.Write($"ID: {item.Id}");
//Console.Write($"Title: {item.Client_Title}");
}
}
};
Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | SharePoint | For business | Windows
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
3 deleted comments
Comments have been turned off. Learn more