private void FindVersions() { SPSecurity.RunWithElevatedPrivileges(delegate() { _versions.Clear(); int count = Helper.Instance.Int(CountText.Text); foreach (SPList list in GetLists()) { foreach (SPListItem item in list.Items) { VersionGridItem gridItem = new VersionGridItem() { Item = item, ListTitle = list.Title, ItemTitle = _utility.GetSimpleDisplayName(item) }; foreach (SPListItemVersion v in item.Versions) { if (!v.IsCurrentVersion) { if ((DateTime.Now - v.Created).TotalDays > count) { gridItem.VersionItems.Add(new VersionItem() { Item = v }); } } } gridItem.VersionCount = gridItem.VersionItems.Count; if (gridItem.VersionItems.Count > 0) { _versions.Add(gridItem); } } } grid.DataSource = _versions.ToList(); }); if (_versions.Count == 0) { SquadronContext.WriteMessage("No item(s) found matching criteria!"); } }
private void IncludeAdditionalProperties(TreeNode rootNode) { foreach (TreeNode node in Helper.Instance.GetAllNodes(rootNode)) { if (!(node.Tag is SPWebApplication)) { node.Text = _utility.GetSimpleDisplayName(node.Tag); IList <string> list = new List <string>(); if (includeSize.Checked) { list.Add(_sizeUtility.GetSizeOf(node.Tag).ToMB().ToString() + " MB"); } if (includeModifiedDate.Checked) { list.Add(_utility.GetLastModifiedDate(node.Tag).ToShortDateString()); } if (list.Count == 0) { continue; } node.Text += " ("; foreach (string s in list) { node.Text += s + ", "; } node.Text = node.Text.Substring(0, node.Text.Length - 2); node.Text += ")"; } } }