Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6140637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:08:40+00:00 2026-05-23T18:08:40+00:00

I am currently trying to connect a C# program with a Sharepoint. What I

  • 0

I am currently trying to connect a C# program with a Sharepoint. What I have: a Sharepoint URL, Username and a Password, no Sharepoint.dll (client machine, no Microsoft.Sharepoint namespace, so I use Sharepoint Web Services), Visual Studio 2010 Ultimate.

I followed this tutorial: http://www.scribd.com/doc/8634090/Accessing-SharePoint-Data-Using-C-Without-Running-Code-On-the-SharePoint-Server-Part-1

What I did so far:

added a “Service Reference” to my project with the URL of my Sharepoint like

https://.../content/10003194/_vti_bin/lists.asmx

and my code:

//no TestSP.Lists here...
TestSP.ListsSoapClient cl = new TestSP.ListsSoapClient();
cl.Open();

String listGUID = "A9E7107B-7AF6-42DC-A1A7-6C898D55D23E";
String viewGUID = "684F5F8A-B32E-461C-BD53-677F84A9C101";

//this is where it crashes
System.Xml.Linq.XElement data = cl.GetListItems(listGUID, viewGUID, null, null, "1000", null, "");

IEnumerable<XElement> elements = data.Elements();

foreach (XElement el in elements)
{
    Console.WriteLine(el);
}

it crashes at the specified line with:

The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘Negotiate,NTLM,Basic realm=”…”‘

which is most likely because I did not specify a username and password. Various tutorials on the web showed shat the credentials can be set like this:

TestSP.Credentials = System.Net.CredentialCache.DefaultCredentials;

Problem is: there is no TestSP.Lists, so I used TestSP.ListsSoapClient, which has no Credentials, only ClientCredentials, which are read-only.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:08:41+00:00Added an answer on May 23, 2026 at 6:08 pm

    You’ve probably used the new “Add Service Reference”, and not “Add Web Reference”. This creates a wrapper similar to WCF (with the Client suffix), and not a Soap based wrapper. You can specify its credentials using:

    TestSP.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
    

    The “Add Web Reference” is hidden in Visual Studio 2010. If you want, you can still use it to generate code similar to your tutorial, but the Service Reference should work as well.

    See also: ClientBase<>.ClientCredentials


    Side note: If all you do is reading list items based of a view, you may want to consider using an xml view – Getting XML Data From a SharePoint List. You can easily get the content by performing a web request. It has some issues with item limit, but it is generally more convenient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to connect to an Oracle DB which is currently offline. When it's
Basically what I'm trying to achieve is a program which allow users to connect
I am currently trying to connect to my Novell LDAP in SSL using C#
I am currently trying to learn J2ME and build a connect four game (some
I am currently working on an Android app and I am trying to connect
I'm currently trying to access a URL with both HTTP and HTTPS. The URL
I'm trying to use Bindings with NSOutlineView. I cannot see how to connect the
I'm trying to write a program that uses sockets to connect with other instances
I've added my iOS app to iTunes Connect and is currently trying to upload
I'm trying to execute a schema file on a SQL Server machine. I currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.