I created a sample application with take Site name as parameter and get all the list of that site, thats working fine on my local system , but it throws exception when i give the site address of other location means of other system's SharePoint site .

How to apply credential at site level?


explain what you mean by "on other system sharepoint site" please? As i understand it you created a console application that takes site as argument?

The console application must always be run on the local server itself (unless you use SharePoint 2010 and use client object model). Also the user needs to have the permissions required to run the code (eg. depending on what you do they could need everything from reader access over owner rights to farm administrator depending on what you do).

If this doesnt help your on, please include error and stack trace in question

  • i m using windows form application to remotely connect to SharePoint Site, all i want to do is just remotely access the SharePoint site using Object model , n get all the lists and items. – sbtahir Dec 20 '10 at 5:31

You first need to add Service reference in you project. I have added it and put name as Webs:

Webs.Webs webs = new Webs.Webs();
webs.Url = "SiteURL" + "/_vti_bin/webs.asmx";//Just pass your site URL here. NetworkCredential nc2 = new NetworkCredential(); nc2.Domain = domain;//Just pass blank if you dont have nc2.UserName = UserName; nc2.Password = password; webs.Credentials = nc2; XmlNode WebNodes=webs.GetWeb("SiteURL")

This is the way you can call functions using webservice.

Let me know if you need any further assistance.


Ashish Chotalia

  • You first need to add Service reference in you project. ?? which service reference??? – sbtahir Dec 27 '10 at 6:07
  • i have a question how we can use this to upload a file to a shared library ?? – sbtahir Dec 27 '10 at 6:23
  • Right click on project -> Add Web Reference -> Place your URL(YourServer:PortNo/_vti_bin/webs.asmx) -> Give WebReferenceName(I provided it as Webs)->Add Reference. It will add reference to your project. Once you have it you can use it as shown below. Webs.Webs webs = new Webs.Webs(); webs.Url = "SiteURL" + "/_vti_bin/webs.asmx" "SiteURL" -> You need to specify your root site collection url here. – Anonymous Dec 29 '10 at 13:12

If you are developing against SharePoint 2010 you can use the client object model to easily interact with the remote environment. Have a good around for "SharePoint 2010 Client Object Model", plenty of tutorials out there to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.