本文整理汇总了C#中Web.DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C# Web.DeleteObject方法的具体用法?C# Web.DeleteObject怎么用?C# Web.DeleteObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web.DeleteObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Teardown
public void Teardown(Web web)
{
web.DeleteObject();
if(deactivatePublishingOnTearDown)
{
using (var ctx = TestCommon.CreateClientContext())
{
ctx.Site.DeactivateFeature(publishingSiteFeatureId);
}
}
}
示例2: DeleteSubWebs
private void DeleteSubWebs(Web web)
{
web.Context.Load(web, item => item.Webs);
web.Context.ExecuteQueryRetry();
for (int i = web.Webs.Count - 1 ; i >= 0; i--)
{
Web subWeb = web.Webs[i];
DeleteSubWebs(subWeb);
}
if (web.IsSubSite())
{
web.DeleteObject();
web.Context.ExecuteQueryRetry();
}
}
示例3: DeleteWeb
private static void DeleteWeb(ClientContext clientContext, Web web)
{
clientContext.Load(web.Webs);
clientContext.ExecuteQuery();
foreach (Web subWeb in web.Webs)
{
DeleteWeb(clientContext, subWeb);
}
web.DeleteObject();
clientContext.ExecuteQuery();
}
示例4: Delete
private void Delete(Web web)
{
if (!base.ShouldProcess(Identity.ToString()))
return;
var ctx = base.Context;
if (!web.IsObjectPropertyInstantiated("Webs"))
{
ctx.Load(web.Webs);
ctx.ExecuteQuery();
}
if (web.Webs.Count > 0)
{
foreach (Web childWeb in web.Webs)
{
Delete(childWeb);
}
if (web.Webs.Count == 0)
{
web.DeleteObject();
web.Context.ExecuteQuery();
}
}
else
{
web.DeleteObject();
web.Context.ExecuteQuery();
}
}
示例5: Teardown
public void Teardown(Web web)
{
web.DeleteObject();
}