Schema of the List Column in SharePoint List

Leave a Comment
The following example(Console) demonstrate the Schema of the Column in SharePoint List.
And Currently i am writing my schema to the text file

 class Program
    {
        static void Main(string[] args)
        {
            try
            {
                using (SPSite site = new SPSite("http://ABC:1947"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\ColumnSchema.txt");
                        SPList issueList = web.Lists["Quick Links"];
                        SPField issueFactor = issueList.Fields["Visible To"];
                        string schemaXML = issueFactor.SchemaXml;
                       // Console.WriteLine(schemaXML);
                        file.WriteLine(schemaXML);
                        file.Close();
                    }
                }
            }
            catch (SPException spex)
            {
                Console.WriteLine(string.Format("{0}\r\n{1}", spex.Message, spex.StackTrace));
            }        
            Console.ReadLine();
        }
    }

Related Post

0 comments:

Post a Comment