Monday, 11 December 2017

To Get Internal Name of List Column (Column Name in Content DB)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("D:\\Test\\manifest.xml");

            //Display all the book titles.
            XmlNodeList elemList = doc.GetElementsByTagName("Field");
            string[] a = new string[elemList.Count];
            for (int i = 0; i < elemList.Count; i++)
            {
                if (elemList[i].Attributes["DisplayName"] != null && elemList[i].Attributes["ColName"] != null)
                {
                    string DisplayName = elemList[i].Attributes["DisplayName"].Value.ToString();
                    string ColName = elemList[i].Attributes["ColName"].Value;
                    a[i] = ColName + " : " + DisplayName;
                }
            }
            System.IO.File.WriteAllLines("D:\\Test\\manifest.txt", a);
        }
    }
}