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
Rajesh Gajulapalle
NA
31
3.8k
The remote server returned an error: (401) Unauthorized.
Apr 24 2018 1:10 AM
i am trying to access my sharepoint 2013 site from console app using csom. i amgetting the error message. The remote server returned an error: (401) Unauthorized.
Code is.
private static void TestConnect(string siteUrl, string userName, string password)
{
try
{
using (ClientContext context = new ClientContext(siteUrl))
{
System.Security.SecureString securePassword = new System.Security.SecureString();
foreach (char c in password.ToCharArray())
{
securePassword.AppendChar(c);
}
context.AuthenticationMode = ClientAuthenticationMode.Default;
context.Credentials = new System.Net.NetworkCredential(userName, securePassword);
Web oWeb = context.Web;
context.Load(oWeb, website => website.Title);
context.ExecuteQuery();
}
}catch (Exception ex)
{
}
}
Reply
Answers (
1
)
Consume SAP service in sharepoint
Sharepoint Online- Creating a footer