private void DeployClearRecycleUnderWeb(object modelHost, WebModelHost typedModelHost, ClearRecycleBinDefinition typedDefinition) { var web = typedModelHost.HostWeb; InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = web, ObjectType = typeof(Web), ObjectDefinition = typedDefinition, ModelHost = modelHost }); if (typedDefinition.RestoreAll) { web.RecycleBin.RestoreAll(); web.Context.ExecuteQueryWithTrace(); } if (typedDefinition.DeleteAll) { web.RecycleBin.DeleteAll(); web.Context.ExecuteQueryWithTrace(); } // TODO, CSOM limitations? if (typedDefinition.MoveAllToSecondStage) { } // TODO, CSOM limitations? if (typedDefinition.DeleteAllInSecondStage) { } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = web, ObjectType = typeof(Web), ObjectDefinition = typedDefinition, ModelHost = modelHost }); }
private void DeployClearRecycleUnderWeb(object modelHost, WebModelHost typedModelHost, ClearRecycleBinDefinition typedDefinition) { var web = typedModelHost.HostWeb; InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = web, ObjectType = typeof(SPWeb), ObjectDefinition = typedDefinition, ModelHost = modelHost }); if (typedDefinition.RestoreAll) { web.RecycleBin.RestoreAll(); } if (typedDefinition.DeleteAll) { web.RecycleBin.DeleteAll(); } if (typedDefinition.MoveAllToSecondStage) { web.RecycleBin.MoveAllToSecondStage(); } if (typedDefinition.DeleteAllInSecondStage) { web.Site.RecycleBin.DeleteAll(); } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = web, ObjectType = typeof(SPWeb), ObjectDefinition = typedDefinition, ModelHost = modelHost }); }