public ListItemVersionNode(SPListItemVersion version) { this.Tag = version; this.SPParent = version.ListItem.ParentList; this.Setup(); this.Nodes.Add(new ExplorerNodeBase("Dummy")); }
/// <summary> /// Reads a field value from a list item version /// </summary> /// <param name="itemVersion">The list item version we want to extract a field value from</param> /// <param name="fieldInternalName">The key to find the field in the item's columns</param> /// <returns>The ImageValue extracted from the list item's field</returns> public override TaxonomyValue ReadValueFromListItemVersion(SPListItemVersion itemVersion, string fieldInternalName) { var fieldValue = itemVersion[fieldInternalName]; if (fieldValue != null) { var taxFieldVal = (TaxonomyFieldValue)fieldValue; var taxValue = new TaxonomyValue(taxFieldVal); var field = (TaxonomyField)itemVersion.Fields.GetFieldByInternalName(fieldInternalName); InitTaxonomyContextForValue(taxValue, field, itemVersion.ListItem.Web.Site); return(taxValue); } return(null); }
public static bool TryGetValue <T>(this SPListItemVersion itemVersion, Guid fieldId, out T value) { try { value = GetValue <T>(itemVersion, fieldId); return(true); } catch (ArgumentException) { throw; } //TODO: define the type of exception catch { value = default(T); return(false); } }
/// <summary> /// Attempts to get a field value of the specified type from the specified list item version and field id. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="version"></param> /// <param name="fieldName"></param> /// <param name="value"></param> /// <returns></returns> public static bool TryGetSPFieldValue <T>(this SPListItemVersion version, string fieldName, out T value) { value = default(T); try { var rawValue = version[fieldName]; if (rawValue == null) { return(false); } value = (T)rawValue; return(true); } catch { return(false); } }
public WBItem(Dictionary <String, String> values) { _listItem = null; _listItemVersion = null; _dictionary = new Dictionary <WBColumn, Object>(); BackingType = BackingTypes.Dictionary; if (values != null) { foreach (String internalColumnName in values.Keys) { WBColumn column = WBColumn.GetKnownColumnByInternalName(internalColumnName); if (column == null) { throw new Exception("In WBItem(Dictionary<,>): Not yet handling situation when an unknown internal name is used: " + internalColumnName); } this[column] = values[internalColumnName]; } } _valuesHaveChanged = false; }
static void Main(string[] args) { using (SPSite site = new SPSite("https://sharepoint.domain.com")) using (SPWeb web = site.OpenWeb()) { SPList list = web.GetList($"{web.ServerRelativeUrl.TrimEnd('/')}/DocumentLibrary"); SPListItemCollection items = list.GetItems(new SPQuery()); foreach (SPListItem item in items) { object checkedOutTo = item[SPBuiltInFieldId.CheckoutUser]; if (checkedOutTo == null) { // Latest version Console.WriteLine($"{item.ID} | {item.Versions[0].VersionLabel}"); } else { // Find latest published version SPListItemVersion version = item.Versions .Cast <SPListItemVersion>() .Where(v => v.Level == SPFileLevel.Published) .FirstOrDefault(); if (version != null) { Console.WriteLine($"{item.ID} | {version.VersionLabel} | {checkedOutTo}"); } else { Console.WriteLine($"{item.ID} | No published version | {checkedOutTo}"); } } } } }
public static SPListItemVersion GetVersionSignedSince(SPListItemVersion thisVersion, string fieldDisplayName) { // The current version has no signature if (thisVersion[fieldDisplayName] == null || thisVersion[fieldDisplayName].ToString().Trim() == "") return null; bool foundVersionOfInterest = false; SPListItemVersion pastVersion = null; foreach (SPListItemVersion version in thisVersion.ListItem.Versions) { // Skip through until reached version // of interest if (!foundVersionOfInterest) { if (version.VersionId == thisVersion.VersionId) { foundVersionOfInterest = true; pastVersion = version; } continue; } // Now start comparing data until // the data has changed. This seems // to be the only way to test when the // field was updated if (!version.Fields.ContainsField(fieldDisplayName)) { // The field didn't exist, maybe // temporarily. So skip this version // and don't advance pastVersion continue; } if (pastVersion != null) { //version[this.FieldName].Equals(pastVersion[this.FieldName] string thisVersionData = ""; if (version[fieldDisplayName] != null) thisVersionData = version[fieldDisplayName].ToString(); string pastVersionData = ""; if (pastVersion[fieldDisplayName] != null) pastVersionData = pastVersion[fieldDisplayName].ToString(); if (!thisVersionData.Equals(pastVersionData)) { // Data differs, so return the last // version for which it was the same return pastVersion; } } pastVersion = version; } return pastVersion; }
public void Map(SPWeb web, object to, SPListItemVersion from) { var listItemMapper = new SPListItemMapper <TEntity>(FieldMappings); listItemMapper.Map(web, to, from.ListItem); }
public static string RenderSignatureBlock(SPListItemVersion version, string fieldDisplayName, bool showVersionInformationText) { StringBuilder sb = new StringBuilder(); SPListItemVersion signedVersion = Utilities.GetVersionSignedSince(version, fieldDisplayName); if (signedVersion != null) { string value = (string)signedVersion[fieldDisplayName]; Utilities.IconMode invalidFlag = Utilities.IconMode.Invalid; try { int hashIndexStart = value.IndexOf("("); int hashIndexEnd = value.IndexOf(")", hashIndexStart); string hash = value.Substring(hashIndexStart + 1, hashIndexEnd - hashIndexStart - 1); string content = value.Substring(0, hashIndexStart).Trim(); HasherType1 hasher = new HasherType1(); HasherType1.Seed seed = new HasherType1.Seed(content, version.ListItem.UniqueId); if (hasher.ValidateHash(seed, hash)) invalidFlag = 0; } catch { } bool listIsVersioned = version.ListItem.ParentList.EnableVersioning; if (!listIsVersioned) sb.Append(Utilities.RenderUserSet(version.ListItem.Web, value, null, Utilities.IconMode.SignedUnversioned | invalidFlag, null)); else if (signedVersion.VersionId == version.VersionId) sb.Append(Utilities.RenderUserSet(version.ListItem.Web, value, FormatTimestamp(version.Created, false), Utilities.IconMode.SignedCurrent | invalidFlag, null)); else { if (showVersionInformationText) { sb.Append(Utilities.RenderUserSet(version.ListItem.Web, value, null, Utilities.IconMode.SignedPrevious | invalidFlag, null)); sb.Append("Signed " + Utilities.FormatTimestamp(signedVersion.Created, true) + " in <a href=\"DispForm.aspx?ID=" + version.ListItem.ID + "&VersionNo=" + signedVersion.VersionId + "\">version " + signedVersion.VersionLabel + "</a>.<br/>"); } else { // Show timestamp anyway, but not full versioning info sb.Append(Utilities.RenderUserSet(version.ListItem.Web, value, FormatTimestamp(version.Created, false), Utilities.IconMode.SignedPrevious | invalidFlag, null)); } } } return sb.ToString(); }
private string GetFieldValue(SPField field, SPListItemVersion version) { string fieldValue = string.Empty; SPFieldType fieldType = field.Type; switch (fieldType) { case SPFieldType.Lookup: SPFieldLookup newField = (SPFieldLookup)field; fieldValue = newField.GetFieldValueAsText(version[field.StaticName]); break; case SPFieldType.User: SPFieldUser newUser = (SPFieldUser)field; fieldValue = newUser.GetFieldValueAsText(version[field.StaticName]); break; case SPFieldType.ModStat: SPFieldModStat modStat = (SPFieldModStat)field; fieldValue = modStat.GetFieldValueAsText(version[field.StaticName]); break; case SPFieldType.URL: SPFieldUrl urlField = (SPFieldUrl)field; fieldValue = urlField.GetFieldValueAsHtml(version[field.StaticName]); break; case SPFieldType.DateTime: SPFieldDateTime newDateField = (SPFieldDateTime)field; if (!string.IsNullOrEmpty(newDateField.GetFieldValueAsText(version[field.StaticName]))) { if (newDateField.DisplayFormat == SPDateTimeFieldFormatType.DateTime) { fieldValue = DateTime.Parse(newDateField.GetFieldValueAsText(version[field.StaticName])).ToString(); } else { fieldValue = DateTime.Parse(newDateField.GetFieldValueAsText(version[field.StaticName])).ToShortDateString(); } } break; case SPFieldType.Invalid: // http://sharepointnadeem.blogspot.com/2013/09/sharepoint-spfieldtype-is-invalid-for.html if (field.TypeAsString.Equals("TaxonomyFieldType") || field.TypeAsString.Equals("TaxonomyFieldTypeMulti")) { TaxonomyField taxonomyField = field as TaxonomyField; fieldValue = taxonomyField.GetFieldValueAsText(version[field.StaticName]); } else { fieldValue = version[field.StaticName].ToString(); } break; default: fieldValue = version[field.StaticName].ToString(); break; } return(fieldValue); }
private void ExportHistory(string[] items, string listID) { SPTimeZone serverzone = SPContext.Current.Web.RegionalSettings.TimeZone; StringBuilder sb = new StringBuilder(); SPList list = SPContext.Current.Web.Lists[new Guid(listID)]; bool isLibrary = false; if (list.BaseType == SPBaseType.DocumentLibrary) { isLibrary = true; } HtmlTable versionTable = new HtmlTable(); versionTable.Border = 1; versionTable.CellPadding = 3; versionTable.CellSpacing = 3; HtmlTableRow htmlrow; HtmlTableCell htmlcell; // Add header row in HTML table htmlrow = new HtmlTableRow(); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Item ID"; htmlrow.Cells.Add(htmlcell); if (isLibrary) { htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "File Name"; htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Comment"; htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Size"; htmlrow.Cells.Add(htmlcell); } htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Version No."; htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Modified Date"; htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = "Modified By"; htmlrow.Cells.Add(htmlcell); foreach (SPField field in list.Fields) { if (field.ShowInVersionHistory) { htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = field.Title; htmlrow.Cells.Add(htmlcell); } } versionTable.Rows.Add(htmlrow); foreach (string item in items) { SPListItem listItem = list.GetItemById(Convert.ToInt32(item)); SPListItemVersionCollection itemVersions = listItem.Versions; SPFileVersionCollection fileVersions = null; if (isLibrary && listItem.FileSystemObjectType == SPFileSystemObjectType.File) { fileVersions = listItem.File.Versions; } for (int i = 0; i < itemVersions.Count; i++) { SPListItemVersion currentVersion = itemVersions[i]; SPListItemVersion previousVersion = itemVersions.Count > i + 1 ? itemVersions[i + 1] : null; htmlrow = new HtmlTableRow(); if (i == 0) { htmlcell = new HtmlTableCell(); htmlcell.RowSpan = itemVersions.Count; htmlcell.InnerHtml = listItem.ID.ToString(); htmlrow.Cells.Add(htmlcell); } if (isLibrary) { if (i == 0) { htmlcell = new HtmlTableCell(); htmlcell.RowSpan = itemVersions.Count; htmlcell.InnerHtml = listItem.File.Name; htmlrow.Cells.Add(htmlcell); } htmlcell = new HtmlTableCell(); HtmlTableCell sizeCell = new HtmlTableCell(); if (i == 0 && listItem.FileSystemObjectType == SPFileSystemObjectType.File) { htmlcell.InnerHtml = currentVersion.ListItem.File.CheckInComment; // Implicit conversion from long to double double bytes = currentVersion.ListItem.File.Length; sizeCell.InnerHtml = Convert.ToString(Math.Round((bytes / 1024) / 1024, 2)) + " MB"; } else { if (null != fileVersions) { foreach (SPFileVersion fileVersion in fileVersions) { if (fileVersion.VersionLabel == currentVersion.VersionLabel) { htmlcell.InnerHtml = fileVersion.CheckInComment; // Implicit conversion from long to double double bytes = fileVersion.Size; sizeCell.InnerHtml = Convert.ToString(Math.Round((bytes / 1024) / 1024, 2)) + " MB"; break; } } } } htmlrow.Cells.Add(htmlcell); htmlrow.Cells.Add(sizeCell); } htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = currentVersion.VersionLabel; htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); DateTime localDateTime = serverzone.UTCToLocalTime(currentVersion.Created); htmlcell.InnerHtml = localDateTime.ToShortDateString() + " " + localDateTime.ToLongTimeString(); htmlrow.Cells.Add(htmlcell); htmlcell = new HtmlTableCell(); htmlcell.InnerHtml = currentVersion.CreatedBy.User.Name; htmlrow.Cells.Add(htmlcell); foreach (SPField field in currentVersion.Fields) { if (field.ShowInVersionHistory) { htmlcell = new HtmlTableCell(); htmlcell.Attributes.Add("class", "textmode"); if (null != currentVersion[field.StaticName]) { if (null == previousVersion) { htmlcell.InnerHtml = GetFieldValue(field, currentVersion); } else { if (null != previousVersion[field.StaticName] && currentVersion[field.StaticName].ToString().Equals(previousVersion[field.StaticName].ToString())) { htmlcell.InnerHtml = string.Empty; } else { htmlcell.InnerHtml = GetFieldValue(field, currentVersion); } } } else { htmlcell.InnerHtml = string.Empty; } htmlrow.Cells.Add(htmlcell); } } versionTable.Rows.Add(htmlrow); } } ExportTableToExcel(versionTable, list.Title); }
public static object GetListItemVersionObject(ScriptEngine engine, SPListItemVersion version, SPField field) { switch (field.Type) { case SPFieldType.Integer: { int value; if (version.TryGetSPFieldValue(field.InternalName, out value)) { return(value); } } break; case SPFieldType.Boolean: { bool value; if (version.TryGetSPFieldValue(field.InternalName, out value)) { return(value); } } break; case SPFieldType.Number: { double value; if (version.TryGetSPFieldValue(field.InternalName, out value)) { return(value); } } break; case SPFieldType.DateTime: { DateTime value; if (version.TryGetSPFieldValue(field.InternalName, out value)) { return(JurassicHelper.ToDateInstance(engine, new DateTime(value.Ticks, DateTimeKind.Local))); } } break; case SPFieldType.URL: { string urlFieldValue; if (version.TryGetSPFieldValue(field.InternalName, out urlFieldValue)) { var urlValue = new SPFieldUrlValue(urlFieldValue); var item = engine.Object.Construct(); item.SetPropertyValue("description", urlValue.Description, false); item.SetPropertyValue("url", urlValue.Url, false); return(item); } } break; case SPFieldType.User: { string userToken; if (version.TryGetSPFieldValue(field.InternalName, out userToken)) { var fieldUserValue = new SPFieldUserValue(version.ListItem.Web, userToken); var userInstance = new SPUserInstance(engine, fieldUserValue.User); return(userInstance); } } break; case SPFieldType.Lookup: { var fieldType = field as SPFieldLookup; if (fieldType == null) { return(null); } if (fieldType.AllowMultipleValues) { object fv; if (!version.TryGetSPFieldValue(field.InternalName, out fv)) { return(null); } var fieldValue = fv as SPFieldLookupValueCollection; var array = engine.Array.Construct(); if (fieldValue != null) { foreach (var lookupValue in fieldValue) { var item = engine.Object.Construct(); item.SetPropertyValue("lookupId", lookupValue.LookupId, false); item.SetPropertyValue("lookupValue", lookupValue.LookupValue, false); ArrayInstance.Push(array, item); } } return(array); } else { object fieldValue; if (!version.TryGetSPFieldValue(field.InternalName, out fieldValue)) { return(null); } var fieldUrlValue = fieldValue as SPFieldUrlValue; if (fieldUrlValue != null) { var urlValue = fieldUrlValue; var item = engine.Object.Construct(); item.SetPropertyValue("description", urlValue.Description, false); item.SetPropertyValue("url", urlValue.Url, false); return(item); } if (fieldValue is DateTime) { var value = (DateTime)fieldValue; return(JurassicHelper.ToDateInstance(engine, new DateTime(value.Ticks, DateTimeKind.Local))); } var userValue = fieldValue as SPFieldUserValue; if (userValue != null) { var fieldUserValue = userValue; var userInstance = new SPUserInstance(engine, fieldUserValue.User); return(userInstance); } if (fieldValue is Guid) { var guidValue = (Guid)fieldValue; var guidInstance = new GuidInstance(engine.Object.InstancePrototype, guidValue); return(guidInstance); } var s = fieldValue as string; if (s == null) { return(fieldValue); } //Attempt to create a new SPFieldLookupValue from the string if (!DigitRegex.IsMatch(s, 0)) { return(fieldValue); } try { var lookupValue = new SPFieldLookupValue(s); var item = engine.Object.Construct(); item.SetPropertyValue("lookupId", lookupValue.LookupId, false); item.SetPropertyValue("lookupValue", lookupValue.LookupValue, false); return(item); } catch (ArgumentException) { return(fieldValue); } } } default: { object value; if (version.TryGetSPFieldValue(field.InternalName, out value)) { var stringValue = field.GetFieldValueAsText(value); return(stringValue); } } break; } return(null); }
/// <summary> /// Creates an adapter with the given object cache. /// </summary> /// <param name="item">Version of a list item.</param> /// <param name="objectCache">Object cache.</param> public SPListItemVersionAdapter(SPListItemVersion item, SPObjectCache objectCache) : base(objectCache) { CommonHelper.ConfirmNotNull(item, "item"); this.instance = item; }
/// <summary> /// Reads a field value from a list item version /// </summary> /// <param name="itemVersion">The list item version we want to extract a field value from</param> /// <param name="fieldInternalName">The key to find the field in the item's columns</param> /// <returns>The value extracted from the list item's field</returns> public abstract T ReadValueFromListItemVersion(SPListItemVersion itemVersion, string fieldInternalName);
public static T GetValue <T>(this SPListItemVersion itemVersion, Guid fieldId) { object o = GetValue(itemVersion, fieldId); return((T)o); }
public static T GetValue <T>(this SPListItemVersion itemVersion, string fieldName) { object o = GetValue(itemVersion, fieldName); return((T)o); }
private string GetTextBoxDateStringVersion(SPListItemVersion item, string column) { string textBox = ""; if (GetEmptyStringIfNull(item[column]) == string.Empty) return DateTime.Now.Date.ToString("dd/MM/yyyy"); textBox = Convert.ToDateTime(GetEmptyStringIfNull(item[column]).ToString(), australiaCulture).ToLocalTime().Date.ToString().Replace(" 12:00:00 AM", ""); textBox = (textBox.Substring(1, 1) != "/") ? textBox : "0" + textBox; //zero pad return textBox; }
public void RaisePostBackEvent(string eventArgument) { SPContext.Current.Web.AllowUnsafeUpdates = true; Guid uniqueId = Guid.Empty; try { string[] eventArg = eventArgument.Split(new string[1] { "#;" }, StringSplitOptions.None); SPWeb rootWeb = SPContext.Current.Site.RootWeb; SPListItem item = SPContext.Current.ListItem; if (!string.IsNullOrEmpty(eventArg[1])) { PageLayout layout = servicePageLayouts.GetPageLayout(new Guid(eventArg[1])); if (item != null && layout != null) { SPFile currentFile = item.File; bool checkout = false; if (currentFile != null && currentFile.Exists) { if (currentFile.CheckOutType == SPFile.SPCheckOutType.None && currentFile.RequiresCheckout) { currentFile.CheckOut(); checkout = true; } } SPUser suser = null; SPListItemVersion spversion = null; SPListItemVersionCollection versions = item.Versions; if (versions.Count > 0) { foreach (SPListItemVersion version in versions) { if (version.IsCurrentVersion) { suser = version.CreatedBy.User; spversion = version; item = version.ListItem; break; } } } /* * else * { * listItem = file.ListItemAllFields; * } */ using (SPSite site = new SPSite(SPContext.Current.Web.Url, suser.UserToken)) { SPWeb spweb = site.OpenWeb(); SPFile spfile = spweb.GetFile(currentFile.UniqueId); SPListItem spitem = spfile.Item.Versions.GetVersionFromLabel(spversion.VersionLabel).ListItem; PublishingPageDesignFieldValue value = spitem[BuildFieldId.PublishingPageDesign] as PublishingPageDesignFieldValue; value.Id = layout.UniqueId; value.Title = layout.Title; value.Url = layout.Url; spitem[BuildFieldId.PublishingPageDesign] = value; try { spitem.Fields[BuildFieldId.PublishingPageDesign].Update(true); } catch (Exception) { } try { spitem.Update(); } catch (Exception) { } try { spitem.SystemUpdate(false); } catch (Exception) { } try { spfile.Update(); } catch (Exception) { } } uniqueId = layout.UniqueId; //currentFile.Update(); if (checkout) { currentFile.CheckIn("Layout Changed", SPCheckinType.OverwriteCheckIn); } } } } catch (Exception ex) { ex.ToString(); //result = ex; } SPContext.Current.Web.AllowUnsafeUpdates = false; url = base.parentStateControl.ContextUri; if (IsEditMode(this.Page)) { url = WebPageStateControl.AddQueryStringParameter(WebPageStateControl.AddQueryStringParameter(url, "ControlMode", "Edit"), "DisplayMode", "Design"); } url = WebPageStateControl.AddQueryStringParameter(url, "PageLayout", DateTime.Now.Ticks.ToString()); base.parentStateControl.EnsureItemSavedIfEditMode(true); this.RefreshPageState(); this.OnPageStateChanged(); //base.ClearChildControlState(); HtmlMeta refresh = new HtmlMeta(); refresh.HttpEquiv = "refresh"; refresh.Content = "0;URL=" + url + ""; this.Page.Header.Controls.Add(refresh); this.Page.Header.Controls.Add(new LiteralControl(Environment.NewLine)); /* * if (IsEditMode(this.Page)) * { * SPUtility.Redirect("~/" + url, SPRedirectFlags.Trusted,HttpContext.Current); * } * else * { * SPUtility.Redirect("~/" + base.parentStateControl.ContextUri, SPRedirectFlags.Trusted, HttpContext.Current); * } */ }
/// <summary> /// Creates an adapter. /// </summary> /// <param name="item">Version of a list item.</param> public SPListItemVersionAdapter(SPListItemVersion item) : this(item, null) { }
protected void Page_Load(object sender, EventArgs e) { String html = "<table class='wbf-record-series-details'>\n"; html += "<tr>" + "<th class='wbf-record-series-odd'>Version</th>" + "<th class='wbf-record-series-even'>Filename</th>" + "<th class='wbf-record-series-odd'>Published</th>" + "<th class='wbf-record-series-even'>Published By</th>" + "<th class='wbf-record-series-odd'>Modified</th>" + "<th class='wbf-record-series-even'>Status</th>" + "<th class='wbf-record-series-odd'>File Size</th>" + "<th class='wbf-record-series-odd'></th>" + "</tr>\n"; String recordSeriesID = Request.QueryString["RecordSeriesID"]; String recordID = Request.QueryString["RecordID"]; using (WBRecordsManager manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName)) { WBRecordsLibrary masterLibrary = manager.Libraries.ProtectedMasterLibrary; SPList masterLibraryList = masterLibrary.List; WBQuery query = new WBQuery(); if (String.IsNullOrEmpty(recordSeriesID) || recordSeriesID == recordID) { query.AddEqualsFilter(WBColumn.RecordID, recordID); } else { query.AddEqualsFilter(WBColumn.RecordSeriesID, recordSeriesID); query.OrderBy(WBColumn.RecordSeriesIssue, false); } SPListItemCollection items = masterLibraryList.WBxGetItems(SPContext.Current.Site, query); /* * List<WBDocument> versions = new List<WBDocument>(); * foreach (SPListItem item in items) * { * * bool notInserted = true; * for (int i = 0; i < versions.Count && notInserted; i++) * { * * * if (document.RecordSeriesIssue.WBxToInt() > versions[i].RecordSeriesIssue.WBxToInt()) * } * * } * */ Dictionary <String, String> checklistTextMap = manager.GetChecklistTextMap(); if (masterLibrary.List.EnableVersioning) { foreach (SPListItem item in items) { SPListItemVersionCollection versionCollection = item.Versions; int versionCount = item.Versions.Count; WBLogging.Debug("Item versions count | File versions count: " + versionCount + " | " + item.File.Versions.Count); for (int i = 0; i < versionCount; i++) { SPListItemVersion version = versionCollection[i]; WBDocument document = new WBDocument(masterLibrary, version); // We're going to render the minor version numbers counting up - even though lower index values are for more recent versions: html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, (versionCount - 1 - i).ToString(), i); } } } else { foreach (SPListItem item in items) { WBDocument document = new WBDocument(masterLibrary, item); html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, null, -1); } } } html += "</table>"; ViewRecordSeriesTable.Text = html; }