Beispiel #1
0
        public Stream OpenBinaryStream()
        {
            if (!IsSPListItem)
            {
                throw new Exception("You can only call WBDocument.OpenBinaryStream() on an SPListItem backed WBDocument");
            }

            SPFile file = Item.File;

            if (file == null)
            {
                throw new Exception("The SPFile of the SPListItem was null");
            }

            SPDocumentLibrary library = file.DocumentLibrary;

            if (library.EnableVersioning)
            {
                SPListItemVersionCollection versionCollection = Item.Versions;
                SPListItemVersion           version           = versionCollection[0];

                file = version.ListItem.File;
            }

            return(file.OpenBinaryStream());
        }
        public SPListItemVersionCollectionInstance(ObjectInstance prototype, SPListItemVersionCollection listItemVersionCollection)
            : this(prototype)
        {
            if (listItemVersionCollection == null)
            {
                throw new ArgumentNullException("listItemVersionCollection");
            }

            m_listItemVersionCollection = listItemVersionCollection;
        }
Beispiel #3
0
        public override void CreateWebPartChildControls()
        {
            bool       authenticated = HttpContext.Current.User.Identity.IsAuthenticated;
            SPListItem item          = SPContext.Current.ListItem;

            try
            {
                int versionId = 0;
                NameValueCollection queryString = HttpContext.Current.Request.QueryString;

                foreach (string key in queryString.AllKeys)
                {
                    if (key != null && key == "PageVersion")
                    {
                        versionId = int.Parse(queryString[key]);
                        break;
                    }
                }
                if (versionId > 0 && !authenticated)
                {
                    SPListItemVersionCollection versions = item.Versions;

                    foreach (SPListItemVersion version in versions)
                    {
                        if (version.VersionId == versionId)
                        {
                            Field = version.Fields[FieldName];
                        }
                    }
                }
            }
            catch { };

            if (item != null)
            {
                try
                {
                    if (Field == null)
                    {
                        Field = item.Fields[FieldName];
                    }

                    if (Field != null)
                    {
                        BaseFieldControl FieldColumnControl = Field.FieldRenderingControl;
                        if (FieldColumnControl != null)
                        {
                            if (FieldColumnControl.ItemContext.FormContext.FormMode != SPControlMode.Invalid)
                            {
                                FieldColumnControl.ItemContext.FormContext.EnableInputFieldLabels = false;
                                FieldColumnControl.InputFieldLabel = string.Empty;
                                FieldColumnControl.ID = Field.InternalName;
                            }

                            if (inEditMode)
                            {
                                FieldColumnControl.ControlMode = SPControlMode.Edit;
                            }
                            else
                            {
                                FieldColumnControl.ControlMode = SPControlMode.Display;
                            }
                        }
                        this.Controls.Add(FieldColumnControl);
                        this.Title = Field.Title;
                    }
                }
                catch (ArgumentException)
                {
                    if (this.DesignMode)
                    {
                        this.Title = "Unknown PagePart";
                        this.Controls.Add(new LiteralControl("The Field for this PagePart is not found"));
                    }
                }
            }

            //base.CreateWebPartChildControls();
        }
Beispiel #4
0
        public override void RenderWebPart(HtmlTextWriter writer)
        {
            bool       authenticated = HttpContext.Current.User.Identity.IsAuthenticated;
            SPListItem item          = SPContext.Current.ListItem;

            try
            {
                int versionId = 0;
                NameValueCollection queryString = HttpContext.Current.Request.QueryString;

                foreach (string key in queryString.AllKeys)
                {
                    if (key != null && key == "PageVersion")
                    {
                        versionId = int.Parse(queryString[key]);
                        break;
                    }
                }
                if (versionId > 0 && !authenticated)
                {
                    SPListItemVersionCollection versions = item.Versions;

                    foreach (SPListItemVersion version in versions)
                    {
                        if (version.VersionId == versionId)
                        {
                            Field = version.Fields[FieldName];
                        }
                    }
                }
            }
            catch { };

            if (item != null)
            {
                try
                {
                    if (Field == null)
                    {
                        Field = item.Fields[FieldName];
                    }

                    var builder = new StringBuilder();
                    using (var baseWriter = new HtmlTextWriter(new StringWriter(builder, CultureInfo.InvariantCulture)))
                    {
                        base.RenderWebPart(baseWriter);
                    }

                    string output = builder.ToString();

                    MatchCollection divs       = Regex.Matches(output, "<div[^>]*>");
                    Match           inputMatch = Regex.Match(output, "<input[^>]*/>");
                    Match           navBegin   = Regex.Match(output, "<nav[^>]*>");
                    Match           navEnd     = Regex.Match(output, "</nav>");

                    string input = string.Empty;
                    if (inputMatch.Success)
                    {
                        input = inputMatch.Value;
                    }

                    string nav = string.Empty;
                    if (navBegin.Success && navEnd.Success)
                    {
                        nav = output.Substring(navBegin.Index, ((navEnd.Index + navEnd.Length) - navBegin.Index));
                        //nav = navBegin.Value;
                    }

                    string div = string.Empty;
                    foreach (Match match in divs)
                    {
                        Match name = Regex.Match(match.ToString(), @"(?<=\bid="")[^""]*");
                        if (name.Success)
                        {
                            div = match.Value;
                        }
                    }

                    StringBuilder cleanInput = new StringBuilder();
                    if (!string.IsNullOrEmpty(input) && !string.IsNullOrEmpty(nav) && !string.IsNullOrEmpty(div))
                    {
                        cleanInput.AppendLine(div);
                        cleanInput.AppendLine(input);
                        cleanInput.AppendLine(nav);
                        cleanInput.AppendLine("</div>");
                    }

                    string clean = cleanInput.ToString();

                    if (!string.IsNullOrEmpty(clean) && (Field.Type == SPFieldType.Note || Field.Type == SPFieldType.Text))
                    {
                        writer.Write(clean);
                    }
                    else
                    {
                        writer.Write(output);
                    }

                    /*
                     * foreach (var match in divs)
                     * {
                     *  string div = match.ToString();
                     *  var name = Regex.Match(match.ToString(), @"(?<=\bname="")[^""]*");
                     *  var internalname = Regex.Match(match.ToString(), @"(?<=\binternalname="")[^""]*");
                     *  var staticname = Regex.Match(match.ToString(), @"(?<=\bstaticname="")[^""]*");
                     * }
                     */

                    /*
                     * if (Field.Type == SPFieldType.Note || Field.Type == SPFieldType.Text)
                     * {
                     *  string id = this.Field.FieldRenderingControl.ID;
                     * }
                     */
                    /*
                     * StringBuilder labelbuilder = new StringBuilder();
                     * labelbuilder.Append("<div class=\"ms-formfieldlabelcontainer\" nowrap=\"nowrap\"><span class=\"ms-formfieldlabel\" nowrap=\"nowrap\">");
                     * string inputFieldLabel = this.Field.FieldRenderingControl.InputFieldLabel;
                     *
                     * if (string.IsNullOrEmpty(inputFieldLabel) && (Field != null))
                     * {
                     *  inputFieldLabel = Field.Title;
                     * }
                     * if (string.IsNullOrEmpty(inputFieldLabel))
                     * {
                     *  inputFieldLabel = Field.FieldRenderingControl.FieldName;
                     * }
                     * labelbuilder.Append(inputFieldLabel);
                     * labelbuilder.Append("</span></div>");
                     * output = output.Replace(labelbuilder.ToString(), String.Empty);
                     */
                }
                catch (ArgumentException)
                {
                    if (this.DesignMode)
                    {
                        base.RenderWebPart(writer);//.Render(writer);
                    }
                }
            }
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string       site;
            StreamWriter SW;

            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine("Enter the Web Application URL:");
                    site = Console.ReadLine();
                }
                else
                {
                    site = args[0];
                }

                SPSite           tmpRoot     = new SPSite(site);
                SPSiteCollection tmpRootColl = tmpRoot.WebApplication.Sites;

                //objects for the CSV file generation
                SW = File.AppendText("c:\\VersioningReport.csv");

                //Write the CSV Header
                SW.WriteLine("Site Name, Library, File Name, File URL, Last Modified, No. of Versions, Latest Version Size -KB,Total Versions Size - MB");

                //Enumerate through each site collection
                foreach (SPSite tmpSite in tmpRootColl)
                {
                    //Enumerate through each sub-site
                    foreach (SPWeb tmpWeb in tmpSite.AllWebs)
                    {
                        //Enumerate through each List
                        foreach (SPList tmpList in tmpWeb.Lists)
                        {
                            //Get only Document Libraries & Exclude specific libraries
                            if (tmpList.BaseType == SPBaseType.DocumentLibrary & tmpList.Title != "Workflows" & tmpList.Title != "Master Page Gallery" & tmpList.Title != "Style Library" & tmpList.Title != "Pages")
                            {
                                foreach (SPListItem tmpSPListItem in tmpList.Items)
                                {
                                    if (tmpSPListItem.Versions.Count > 5)
                                    {
                                        SPListItemVersionCollection tmpVerisionCollection = tmpSPListItem.Versions;

                                        //Get the versioning details
                                        foreach (SPListItemVersion tmpVersion in tmpVerisionCollection)
                                        {
                                            int    versionID       = tmpVersion.VersionId;
                                            string strVersionLabel = tmpVersion.VersionLabel;
                                        }

                                        //Get the versioning Size details
                                        double versionSize = 0;
                                        SPFile tmpFile     = tmpWeb.GetFile(tmpWeb.Url + "/" + tmpSPListItem.File.Url);

                                        foreach (SPFileVersion tmpSPFileVersion in tmpFile.Versions)
                                        {
                                            versionSize = versionSize + tmpSPFileVersion.Size;
                                        }
                                        //Convert to MB
                                        versionSize = Math.Round(((versionSize / 1024) / 1024), 2);

                                        string siteName;
                                        if (tmpWeb.IsRootWeb)
                                        {
                                            siteName = tmpWeb.Title + " - Root";
                                        }
                                        else
                                        {
                                            siteName = tmpSite.RootWeb.Title + " - " + tmpWeb.Title;
                                        }

                                        //Log the data to a CSV file where versioning size > 0MB!
                                        if (versionSize > 0)
                                        {
                                            SW.WriteLine(siteName + "," + tmpList.Title + "," + tmpSPListItem.Name + "," + tmpWeb.Url + "/" + tmpSPListItem.Url + "," + tmpSPListItem["Modified"].ToString() + "," + tmpSPListItem.Versions.Count + "," + (tmpSPListItem.File.Length / 1024) + "," + versionSize);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                //Close the CSV file object
                SW.Close();

                //Dispose of the Root Site Object
                tmpRoot.Dispose();

                //Just to pause
                Console.WriteLine(@"Versioning Report Generated Successfull at c:\VersioningReport.csv. Press ""Enter"" key to Exit");
                Console.ReadLine();
            }

            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("Get Versioning Report", ex.Message);
            }
        }
Beispiel #7
0
        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);
             * }
             */
        }
Beispiel #8
0
        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;
        }
        /// <summary>Initializes a new instance of the <see cref="CustomRecordListItems"/> class.</summary>
        /// <param name="url">The url.</param>
        /// <param name="sourceFolder">The source folder.</param>
        /// <param name="destinationFolder">The destination folder.</param>
        public CustomRecordListItems(string url, string sourceFolder, string destinationFolder)
        {
            if (String.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException(url, "Inavild url");
            }

            if (String.IsNullOrEmpty(sourceFolder))
            {
                throw new ArgumentNullException(sourceFolder, "Invalid folder");
            }

            if (String.IsNullOrEmpty(destinationFolder))
            {
                throw new ArgumentNullException(destinationFolder, "Invalid folder");
            }

            this.DocumentsSourceFolder = sourceFolder;
            this.DocumentsFinalFolder  = destinationFolder;

            using (SPSite spSite = new SPSite(url))
                using (SPWeb spWeb = spSite.OpenWeb())
                {
                    // EcmDoc
                    EcmDocumentRoutingWeb ecmDocumentRoutingWeb = new EcmDocumentRoutingWeb(spWeb);

                    // current user specs
                    this.LoginName     = System.Threading.Thread.CurrentPrincipal.Identity.Name;
                    this.DocumentsUser = SPContext.Current.Web.CurrentUser;

                    // screening the source folder
                    SPList spList = spWeb.Lists[sourceFolder];
                    this.DocumentsFields = spList.Fields;
                    int fieldsLimit = spList.Fields.Count;

                    // viewing all items in source folder
                    SPView spView = spList.Views["All Items"];

                    // current view fields on all items in source folder
                    this.DocumentsViewFields = spView.ViewFields;
                    int viewFieldsLimit = spView.ViewFields.Count;

                    // screening the item collection for each item
                    this.DocumentsItems = spList.Items;

                    foreach (SPListItem spListItem in this.DocumentsItems)
                    {
                        SPContentType               spContentType               = spListItem.ContentType;
                        SPCopyFieldMask             spCopyFieldMask             = spListItem.CopyFieldMask;
                        SPCopyDestinationCollection spCopyDestinationCollection = spListItem.CopyDestinations;
                        string                      displayName       = spListItem.DisplayName;
                        SPBasePermissions           spBasePermissions = spListItem.EffectiveBasePermissions;
                        SPFieldCollection           spFieldCollection = spListItem.Fields;
                        SPFile                      spFile            = spListItem.File;
                        SPFolder                    spFolder          = spListItem.Folder;
                        SPFileLevel                 spFileLevel       = spListItem.Level;
                        string                      name       = spListItem.Name;
                        Hashtable                   properties = spListItem.Properties;
                        string                      title      = spListItem.Title;
                        string                      strUrl     = spListItem.Url;
                        SPListItemVersionCollection spListItemVersionCollection = spListItem.Versions;
                        string                      xml = spListItem.Xml;
                    }
                }
        }