Posts Tagged ‘Sites’

SharePoint Web Services – Creating New Sites

Thursday, December 31st, 2009

SharePoint offers a very good object model which allows a developer to achieve just about anything. But what happens in situations when the developer must achieve certain functionality, but his or her code is not running on a server hosting SharePoint? That’s where the SharePoint Services step in.

Anyone who has tried to manage content in SharePoint using SharePoint Services knows that it can be a very challenging task. A lot of functionalities are limited, or don’t exist at all. Some of them are very basic and it can be a real mind cracker when it comes to the development of more complex functionalities. For example, there is no service that provides the method to delete a web site – a quite extraordinary fact, if I may add. Of course, the developer may develop a custom web service and use it for his or her purpose. However, sometimes a client requires the development of an application which is not allowed to add anything to the server machines. When that happens, the only tool left for the developer to use is the existing coding arsenal and his or her wit.

One of the very common and basic functionalities that may arise in the never ending list of client requirements is to develop a code which creates SharePoint sites. This should be rather easy, right? Well, not quite so. On this MSDN page you may see the list of all available web services. A web service websvcSites may appear tempting judging by its name, but it deals with the site content migration and site templates information. The websvcAdministration web service “provides methods for managing a deployment of Windows SharePoint Services, such as for creating or deleting sites”, as stated on the page. Unfortunately, by the term sites the documentation actually refers to site collections, thus our problem still remains unsolved.

The solution, believe it or not, lies in the web service called websvcMeetings. This service contains a class Meetings with a method CreateWorkspace. The purpose of this method is to create SharePoint meeting workspaces. It may seem odd to use such a method, because we are not actually trying to create a meeting workspace, but a site instead. The key lies in one of the method arguments – site template. By providing a site template other than the meeting workspace template, the method will create a corresponding site. This small trick extends the purpose of the method and solves the challenge of creating SharePoint sites using SharePoint web services.

The complete list of SharePoint’s default site templates can be found on this page. For custom templates, the developer should provide the name of the site template file which has been previously uploaded to the site collection’s site template gallery.

There are a few disadvantages with this method. For example, there is no option to set the permissions inheritance or whether the new site will contain the top navigation bar from its parent site. Actually, there are no SharePoint web services for the top navigation what so ever. This and many other disadvantages are eagerly expected to be implemented and enriched in the future releases of SharePoint platform.

VN:F [1.0.8_357]
Rating: 10.0/10 (1 vote cast)

Share/Save/Bookmark