private void ApplySecurity(ClientContext ctx) { if (ctx.Web.AppInstanceId != default(Guid)) { return; } var secureObjects = new List <SecureObjectCreator>(); foreach (var creator in Creators.Values) { if (creator.SecurityConfiguration != null) { OnNotify(ProvisioningNotificationLevels.Verbose, "Applying security to " + creator.Url); creator.SecurityConfiguration.SecurableObject = creator.File.ListItemAllFields; creator.SecurityConfiguration.SecureObjectType = SecureObjectType.File; secureObjects.Add(creator.SecurityConfiguration); } } if (secureObjects.Count > 0) { ctx.ExecuteQueryRetry(); var secureObjectManager = new SecureObjectManager(ctx) { SecureObjects = secureObjects }; secureObjectManager.ApplySecurity(); } }
private void ApplySecurity() { if (!_isHostWeb) { return; } var secureObjects = new List <SecureObjectCreator>(); foreach (var creator in Creators.Values) { if (creator.SecurityConfiguration != null) { OnNotify(ProvisioningNotificationLevels.Verbose, "Applying security to " + creator.Title); creator.SecurityConfiguration.SecurableObject = creator.List; creator.SecurityConfiguration.SecureObjectType = SecureObjectType.List; secureObjects.Add(creator.SecurityConfiguration); } } if (secureObjects.Count > 0) { var secureObjectManager = new SecureObjectManager(_ctx) { SecureObjects = secureObjects }; secureObjectManager.ApplySecurity(); } }