3 ways to find SharePoint list field’s Internal name

Update: If you want a quicker solution, please check out my new CAML Viewer Web Part for SharePoint 2010.

While working with caml query there may be cases where we may need to refer internal name of a sharepoint list and in some of the cases the display name and internal name may be different. If you try to access this list we will get object not found error.

We can find out the sharepoint field’s internal name using any of the following ways
1. Using browser (it applies to custom fields only)
Go to list settings -> Edit column. Then you can see field name from the query string

2. Object model (it applies for custom fields as well as system fields)

[sourcecode language="csharp"]
string siteUrl = "http://mysite";
SPSite site = new SPSite(siteUrl);
SPWeb web = site.OpenWeb();
SPList list = web.Lists["my forum"];
for (int i = 0; i < list.Fields.Count; i++)
Console.WriteLine(list.Fields[i].Title + "…" + list.Fields[i].InternalName + "…");
Console.ReadLine();
[/sourcecode]

3. Powershell (it applies for custom fields as well as system fields)

[sourcecode language="powershell"]
[system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
$site= New-Object Microsoft.SharePoint.SPSite ("http://mysite")
$web=$site.OpenWeb()
$list=$web.Lists["my forum"]
$list.Fields |select title, internalname| more
[/sourcecode]

About Hojo Clement

Hojo Clement was working in US Technology in Trivandrum as a Senior Software Engineer. He has 6 years experience in working with Web Development Technologies inlcuding MOSS and ASP.net.

4 thoughts on “3 ways to find SharePoint list field’s Internal name

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>