Web Manager
Andreas Scharf edited this page Aug 20, 2013
·
28 revisions
##Create
Parameter Name | Type | Description |
---|---|---|
title | string | title of the new web |
description | string | description of the new web |
url | string | url of the new web |
template | string | template of the new web; a list of the default templates |
####Example
//this code will create a new SPWeb at http://dev/awesomeweb
using (var mgr = new SPManager("http://dev"))
{
var web = mgr.Webs.Create("My Awesome Web", "", "awesomeweb", "STS#0");
//do something with the web here
//web.Title = "Changed haha!";
//dont forget to dispose the web after you are done!
web.Dispose();
}
##Exists
Prameter Name | Type | Description |
---|---|---|
url | string | url of the web to be checked |
####Example
//this code will check whether the SPWeb at http://dev/awesomeweb exist
using (var mgr = new SPManager("http://dev"))
{
if(mgr.Webs.Exists("awesomeweb"))
{
//web exists, do something cool here
}
}
##Delete
Parameter Name | Type | Description |
---|---|---|
url | string | url of the web to be deleted |
####Example
//this code will delete the SPWeb at http://dev/awesomeweb
using (var mgr = new SPManager("http://dev"))
{
//check if the web exists
if(mgr.Webs.Exists("awesomeweb"))
{
//delete it
mgr.Webs.Delete("awesomeweb");
}
}
Back to SPManager.