0

I am trying to add a list using the addlist method of Lists webservice. I am not sure how actually I have to get that done.

But I have tried this taking MSDN as reference 1 Added the Lists WebService reference in my empty sharepoint project 2 Added a New Application Page in my solution 3 Have added this code in my Page_Load function

Lists listreference = new Lists(); listreference.Url = "http://'My_Servername'/_vti_bin/lists.asmx"; listreference.Credentials = CredentialCache.DefaultCredentials; XmlNode ndList = listreference.AddList("WSList", "Adding List using WS", 100); Label1.Text = "List Created";

4.My solution is successfully deployed but I don't see it in my SPSITE. 5 Am I missing something or Is it not the application page that I should Use or Any other idea??

Any help in making my effort successful would be deeply appreciated

1
  • Hey All, I achieved it.. No Problem Will post If I face any trouble
    – kart
    Aug 28, 2012 at 12:09

2 Answers 2

1

I think issue in this line: XmlNode ndList = listreference.AddList("WSList", "Adding List using WS", 100); Label1.Text = "List Created";

Following code is working for me:

        string listName = "Custom List";
        string description = "List created using SharePoint Web Service";
        // template id for Custom List - 100
        int templateId=100;
        Lists listReference = new Lists();
        listReference.Url = "http://server/_vti_bin/lists.asmx";
        listReference.Credentials = CredentialCache.DefaultCredentials;
        listReference.AddList(listName, description,templateId);
1
  • Hi Ravi, I did the same.. But I have passed the values dynamically. Thanks for the correction
    – kart
    Aug 29, 2012 at 5:39
0

I achieved it.. No Problem Will post If I face any trouble

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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