protected override void ExecuteCmdlet() { if (string.IsNullOrEmpty(Folder)) { if (CurrentWeb.PropertyBagContainsKey(Key)) { if (Force || ShouldContinue(string.Format(Properties.Resources.Delete0, Key), Properties.Resources.Confirm)) { CurrentWeb.RemovePropertyBagValue(Key); } } } else { CurrentWeb.EnsureProperty(w => w.ServerRelativeUrl); var folderUrl = UrlUtility.Combine(CurrentWeb.ServerRelativeUrl, Folder); var folder = CurrentWeb.GetFolderByServerRelativePath(ResourcePath.FromDecodedUrl(folderUrl)); folder.EnsureProperty(f => f.Properties); if (folder.Properties.FieldValues.ContainsKey(Key)) { if (Force || ShouldContinue(string.Format(Properties.Resources.Delete0, Key), Properties.Resources.Confirm)) { folder.Properties[Key] = null; folder.Properties.FieldValues.Remove(Key); folder.Update(); ClientContext.ExecuteQueryRetry(); } } } }
protected override void ExecuteCmdlet() { if (Keys != null && Keys.Count > 0) { CurrentWeb.RemovePropertyBagValue("vti_indexedpropertykeys"); foreach (var key in Keys) { CurrentWeb.AddIndexedPropertyBagKey(key); } } }