TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jeevanandham Muthusamy
NA
43
10k
The remote server returned an error: (403) Forbidden
Aug 22 2018 6:55 AM
I am creating one small console application in C# to get the list name in the site. but I received this error message The remote server returned an error: (403) Forbidden.
Please help me to solve this issue.
This is the code i am using :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using System.Net;
using System.Security;
namespace CSOMCodeSamples
{
class Program
{
static void Main(string[] args)
{
string password = "Password";
ClientContext clientContext = new ClientContext("URL");
var securePassword = new SecureString();
foreach (char c in password)
{
securePassword.AppendChar(c);
}
clientContext.Credentials = new NetworkCredential("UserName", securePassword, "Domain");
Web web = clientContext.Web;
ListCollection listColl = web.Lists;
clientContext.Load(listColl);
clientContext.ExecuteQuery();
foreach (List list in listColl)
{
// Display the list title and ID
Console.WriteLine("List Name: " + list.Title + "; ID: " + list.Id);
}
Console.ReadLine();
}
}
}
Reply
Answers (
4
)
SharePoint Framework Webpart: SPFx webpart issue clientforms
How to call Web services using REST API