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 + "…");

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

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

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.

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

  1. If this was PHP I would say “bad idea”. But I know much less about JavaScript so perhaps it’s not. in oitpon 1 you use language constructs (I would think it would be even better to use values[] rather than the method .push). In oitpon 2 you use a method to run a callback function on each element. I’m guessing there’s an order of magnitude difference in performance (if not more). Albeit with a select box there’s probably not too many oitpons to iterate through, but other scenarios may have significantly more.

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>