Tenant.CreateSite método
Filas de um conjunto de sites para a criação com as propriedades especificadas.
Namespace: Microsoft.Online.SharePoint.TenantAdministration
Assemblies: Microsoft.Online.SharePoint.Client.Tenant.Silverlight (em Microsoft.Online.SharePoint.Client.Tenant.Silverlight.dll); Microsoft.Online.SharePoint.Client.Tenant (em Microsoft.Online.SharePoint.Client.Tenant.dll)
Sintaxe
'Declaração
Public Overridable Function CreateSite ( _
siteCreationProperties As SiteCreationProperties _
) As SpoOperation
'Uso
Dim instance As Tenant
Dim siteCreationProperties As SiteCreationProperties
Dim returnValue As SpoOperation
returnValue = instance.CreateSite(siteCreationProperties)
public virtual SpoOperation CreateSite(
SiteCreationProperties siteCreationProperties
)
Parâmetros
siteCreationProperties
Tipo: Microsoft.Online.SharePoint.TenantAdministration.SiteCreationPropertiesUm objeto de SiteCreationProperties que contém as propriedades iniciais do novo conjunto de sites.
Valor retornado
Tipo: Microsoft.Online.SharePoint.TenantAdministration.SpoOperation
Um objeto de SpoOperation que contém informações sobre a operação de criação de conjunto de sites.
Comentários
Este exemplo mostra como usar o método CreateSite .
/// <summary>
/// Create a new site.
/// </summary>
/// <param name="targetUrl">rootsite + "/" + managedPath + "/" + sitename: e.g. "https://auto.contoso.com/sites/site1"</param>
/// <param name="title">site title: e.g. "Test Site"</param>
/// <param name="owner">site owner: e.g. admin@contoso.com</param>
/// <param name="siteTemplate">The site template used to create this new site</param>
internal void CreateSite(String targetUrl, String title, String owner, String siteTemplate)
{
var ctx = new ClientRuntimeContext(targetUrl);
var tenant = new Tenant(ctx);
//Create new site
var newsite = new SiteCreationProperties()
{
Url = targetUrl,
Owner = owner,
Template = siteTemplate,
Title = title,
StorageMaximumLevel = 1000,
StorageWarningLevel = 500,
TimeZoneId = 7,
UserCodeMaximumLevel = 7,
UserCodeWarningLevel = 1,
};
var spoOperation = tenant.CreateSite(newsite);
ctx.Load(spoOperation);
ctx.ExecuteQuery();
while (!spoOperation.IsComplete)
{
Thread.Sleep(2000);
ctx.Load(spoOperation);
ctx.ExecuteQuery();
Console.WriteLine("Site creation status: " + (spoOperation.IsComplete ? "waiting" : "complete"));
}
}