开发者

Problem creating SharePoint site using Web Service Admin.CreateSite() method

开发者 https://www.devze.com 2023-01-27 09:55 出处:网络
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 ru

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", "myemail@address.com", "", "");

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


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):

  • Sharepoint V3 Web service : how to create a subweb using WebService ?
  • Create Subsite Through Sharepoint Web Services
0

精彩评论

暂无评论...
验证码 换一张
取 消