Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

REST Query to Get Content Type Name

$
0
0

I'm just getting started learning to use the SharePoint REST interface.  One of the first things I'd like to do is return the content type name for a list item in a document library (the document library is configured with several content types).  From what I've read, it looks like I need to use the $expand query option.  So, my REST query looks like this:

http://localhost/_api/web/lists/Documents/Items()?&$select=ContentType/Name&$expand=ContentType/Name

But it's not working.  I can't "dig" out the content type name property.  In other words the $expand query option is not working.  I just receive the following which includes a link to the content type: 

  <entry m:etag="&quot;2&quot;">

    <id>4078e129-ac4b-44b8-b469-bcc083f2268d</id>
    <category term="SP.Data.DocumentsItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="Web/Lists(guid'cd710fd1-057e-4ee7-b0bd-1f014218ea3e')/Items(36)" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'cd710fd1-057e-4ee7-b0bd-1f014218ea3e')/Items(36)/ContentType" />
    <title />
    <updated>2013-04-12T00:16:26Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml" />
  </entry>

I've tried difference variations and if I just use "$expand=ContentType" then I get all the list items with the content type fully expanded within each item.

What am I missing?


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>