views:

174

answers:

3

Hi,

I want to programatically create list on Sharepoint using Web Services. I tried "Lists.AddList Method" but it would create list in current site only.

Is there any other way to create list? (Using Web Services : C#)

A: 

You can create SPWeb object of the desired location and add list in it dynamically. See following:
http://msdn.microsoft.com/en-us/library/ms425818.aspx

Brij
thanx Brij.But i am looking for solution using Web Services. (not using Microsoft.Sharepoint.dll)
Preeti Singh
A: 

Have you tried this MSDN page, Lists.AddList Method (Lists)?

I think here you can find what you need.

jaloplo
thanx jaloplo.But as mentioned in my post above.List.AddList Method add list in current site.But here i want to create list on my own site (taking input from user)
Preeti Singh
Well, though question was answered, you can call any sharepoint web service from any of their webs. For example, you have a site with this url: http://yoursite.com, and you have a sub sub site with the url: http://yoursite.com/web/subweb. To call lists web service for this web you can use: http://yoursite.com/web/subweb/_vti_bin/lists.asmx, and create any list you need.
jaloplo
+1  A: 

To Create List on specified path

        Lists listService            = new Lists();
        listService.PreAuthenticate  = true;
        listService.Credentials      = new NetworkCredential(username,password,domain;
        String url                   = "http://YourServer/SiteName/"; // put your desired path here 
        listService.Url              = url @ + /_vti_bin/lists.asmx";

        XmlNode ndList               = listService.AddList(NewListName, "Description", 100);
Jene
Thanx Ane it's working now
Preeti Singh