Пример #1
0
        private ReportRow ScanWeb(SPWeb web)
        {
            ReportRow webRow = new ReportRow(this, web);

            foreach (SPField field in web.Fields)
            {
                this.GetFieldLabel(field);
            }

            foreach (SPList list in web.Lists.Cast <SPList>().OrderBy(l => l.ID).OrderBy(l => l.Title))
            {
                foreach (SPField field in list.Fields)
                {
                    this.GetFieldLabel(field);
                }

                ReportRow listRow = new ReportRow(this, list);
                listRow.ParentRow = webRow;
            }

            foreach (SPWeb childWeb in web.Webs.OrderBy(w => w.ServerRelativeUrl).OrderBy(w => w.Title))
            {
                ReportRow childWebRow = this.ScanWeb(childWeb); // recurse
                childWebRow.ParentRow = webRow;
            }

            return(webRow);
        }
Пример #2
0
        public void WriteRowValues(StreamWriter streamWriter, Dictionary <string, string> rowValues,
                                   ReportRow row)
        {
            for (int i = 0; i < this.ReportColumnKeysAndTitles.Count; ++i)
            {
                string key = this.ReportColumnKeysAndTitles[i].Key;

                if (i > 0)
                {
                    streamWriter.Write(",");
                }

                string value = string.Empty;
                if (rowValues.TryGetValue(key, out value))
                {
                    if (value.Contains("\"") || value.Contains(","))
                    {
                        value = "\"" + value.Replace("\"", "\"\"") + "\"";
                    }
                }
                streamWriter.Write(value);
            }
            streamWriter.WriteLine();
        }
Пример #3
0
 public void BuildRowsAndFields(SPWeb rootWeb)
 {
     this.rootRow = ScanWeb(rootWeb);
 }