Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
    
Hey All, I achieved it.. No Problem Will post If I face any trouble –  kart Aug 28 '12 at 12:09

2 Answers 2

up vote 1 down vote accepted

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);
share|improve this answer
    
Hi Ravi, I did the same.. But I have passed the values dynamically. Thanks for the correction –  kart Aug 29 '12 at 5:39

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

share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. –  John Chapman Oct 17 '12 at 14:33
    
Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. –  SPArchaeologist Dec 19 '12 at 11:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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