canuckconsulting
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?
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?
The @ is allowing you to put slashes and backslashes into the string.
MyDomain\UserID should be fine.
MyDomain\UserID should be fine.
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?
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?
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/
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/
ASKER
Yes, i log in with DOMAIN\first.last
I'll have a look at the Sharepoint link..thanks for that.
I'll have a look at the Sharepoint link..thanks for that.
http://the-north.com/sharepoint/post/2008/02/10/Accessing-Sharepoint-Documents-from-Winforms-via-HTTPS.aspx
Would your requirements extend beyond this?