How To Quickly and Easily Get a List of Fields in a SharePoint 2013 List.
This is going to be the first of two short postings, because while they are related, they are also individually interesting. I was looking for some CSOM to work with Ratings in SharePoint 2013 and not finding much in the way of documentation. After deducing that I would have to go a little well-defined CSOM code, and a little "late bound" code, my next problem was to figure out what fields I needed to retrieve. The fields that hold this content are hidden which makes them tough to figure out using the out of the box UI. However you can get this information pretty easily using the REST endpoint. The way to do it is to just enter this in the browser:
https://theSiteName/_api/web/lists/GetByTitle('theListName')/Fields
This gives you a complete XML dump of the list schema. If you're using IE though you will probably not see the Xml, but instead get the ever so useful RSS feed viewer. To get a handle on this quickly I recommend the following:
- Right-click and select View Source.
- Copy everything.
- Open up Visual Studio 2012 and add a new Xml document.
- Delete the default goo in the document then paste in the Xml from the browser. It will still look like an unformatted jumble of gooey mess.
- On the toolbar you should see an item that looks like a document; if you hover over it the tooltip will say something like "Format the whole document (CTRL + K, CTRL + D). Click that - XML happiness ensues.
Once you've formatted the Xml document you can find your field names in the InternalName element. Hope that helps.
Comments
Anonymous
January 01, 2003
The comment has been removedAnonymous
October 10, 2013
Great tip! If you disable feed reading view (Internet Options -> Content -> Feeds [Settings]) you immediately get a nicely formatted XML view where you can search for "InternalName".Anonymous
March 02, 2015
I wrote a related post today about how to find the fields names in a list: http://blogs.technet.com/b