1
votes

I am having a problem creating a SharePoint site using the Admin SharePoint Web service. My basic environment is an instance of SharePoint 2007 running on one machine (server) and some VS 2008 code running on a second machine (client). Both machines are in the same domain. In VS 2008, I added a Web reference using the URL http://server:8586/_vti_adm/Admin.asmx?WSDL, and in my code I have:

service.Admin admin = new service.Admin();

System.Net.NetworkCredential credentials =
  new System.Net.NetworkCredential("username", "password", "DOMAIN");

admin.Credentials = credentials;

admin.CreateSite("siteName", "Site Name", "This describes site", 1033, "STS#1",
  @"DOMAIN\username", "username", "[email protected]", "", "");

This compiles fine, but when I run it, I get an error of the form:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

I have tried various variations, but without success. Can anyone see anything obviously wrong? At this point what is most frustrating is not being able to find any logging on the SharePoint server to indicate the cause of the exception. Where should I look for SharePoint Web service logs? Note that I can invoke other SharePoint Web services such as Lists without any problem. The problem seems to be something specific with the Admin service.

Thanks, in advance, for any help. Martin

1

1 Answers

2
votes

You are trying to create a new site (SPWeb) using the CreateSite method, which creates site collections (SPSite) not sites.

Although there is no CreateWeb method in any SharePoint 2007 web service (SharePoint 2010 does have such a method), you can use the CreateWorkspace method from the Meetings web service to create a new site using any site definition (not only the Meeting Workspace ones):