Avatar of canuckconsulting
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Connect to Sharepoint server using .Net C#

We have a corporate Sharepoint 2007 server which I would like to connect to using .Net.  My domain is recognised and I am open the following Excel spreadsheet using the following path:


I am using Visual Studio 2010 Pro and need to process this Excel from a Windows Forms c# application.  I will need to specify credentials as this may be run from an account without sufficient permissions.
Microsoft SharePoint.NET ProgrammingC#

Avatar of undefined
Last Comment

8/22/2022 - Mon
Jamie McAllister

Well, I wrote this a while back to supply credentials and return a file from SP;


Would your requirements extend beyond this?
Jamie McAllister

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

This looks great!

I am receiving the error "The remote server returned an error: (401) Unauthorized.".  What format do you use to submit credentials?  I used "EMEA\my.name".  Is this correct?

Also what does the "@" symbol indicate?
Jamie McAllister

The @ is allowing you to put slashes and backslashes into the string.

MyDomain\UserID should be fine.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

@...very handy!

If I log in as myself with my account and set UseDefaultCredentials to true I can connect but if I set it to false and try again I continue to get the unauthorized error."  Any thoughts?

Also have you been able to use this system to create a new document in sharepoint and/or update an existing one?
Jamie McAllister

Is there a dot in the username? Do you normally login with that ID?

I wouldn't use this to create a document. I'd probably call the lists.asmx web services for that or use Client Object Model.


Yes, i log in with DOMAIN\first.last

I'll have a look at the Sharepoint link..thanks for that.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.