Avatar of canuckconsulting
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:

http://coll.isite.mycompany.net/corp/it/Documents/SD%20Metrics.xlsx

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
canuckconsulting

8/22/2022 - Mon
Jamie McAllister

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

http://the-north.com/sharepoint/post/2008/02/10/Accessing-Sharepoint-Documents-from-Winforms-via-HTTPS.aspx

Would your requirements extend beyond this?
ASKER CERTIFIED SOLUTION
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
or
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
canuckconsulting

ASKER
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
canuckconsulting

ASKER
@...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.

http://www.sharepointdynamics.net/2008/01/how-to-add-a-new-list-item-to-sharepoint-using-the-list-item-web-service/
canuckconsulting

ASKER
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.