I created a library that contains documents in Sharepoint Online. Let's call it myLib. I also created a content type, myCT. My objective is to retrieve informations concerning fields I created in a content type in sharepoint online. The library is using the content type i created.

For this i also created a webpart component that aims to generate a form with the content type fields / columns. I need to retrieve :

  • the field name
  • the field type
  • the values (for select, radio buttons, checkboxes)

For this I found that i can access XML datas from sharepoint at this URI : https://myAppUrl.sharepoint.com/_api/web/

enter image description here

My issue is that I spent a rather long time trying to find where the data from the content type is stored. I tried those URLs :

Without finding what i'm looking for. I also tried to create a script in the webpart: :

function getallContentTypes() {
    var clientContext = SP.ClientContext.get_current();
    oContentTypes = clientContext.get_web().get_contentTypes();
        Function.createDelegate(this, function() {
            var ctypesInfo = '';
            var ctypesEnumerator = oContentTypes.getEnumerator();

            while (ctypesEnumerator.moveNext()) {
                var ocontentType = ctypesEnumerator.get_current();
                ctypesInfo += '\n' + 'ContentType Title: ' + ocontentType.get_name()+'\t'+ ocontentType.get_id();
        Function.createDelegate(this, function() {

function injectMethod(){
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");

it returned me information concerning the content type : ContentType Title: myCT 0x0101007D18D0E5D0A176498869E2673AD0CA14

Now i wish to know how to handle this.

UPDATE after FredericDietrich help : I tried to use URL like : _api/Web/ContentTypes?$select=Name,Id,StringId&$filter=Name eq 'myCT'

And i obtain an XML:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xml:base="https://dsidiff365.sharepoint.com/_api/">
    <title />
    <entry>                <id>https://myurl.sharepoint.com/_api/Web/ContentTypes('0x010100ED0CEB986D733A47AD45D9A995911BAA')</id>
        <category term="SP.ContentType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <link rel="edit" href="Web/ContentTypes('0x010100ED0CEB986D733A47AD45D9A995911BAA')" />
        <title />
            <name />
        <content type="application/xml">
                <d:Id m:type="SP.ContentTypeId">

but no information concerning fields

2 Answers 2


you can use a REST request as below


enter image description here

  • I obtain : <m:code>-1, Microsoft.SharePoint.Client.ResourceNotFoundException</m:code>
    – davidvera
    Nov 27, 2019 at 13:57
  • in my sample i use list : Pages, on web contentTypes prefer this : /_api/web/AvailableContentTypes?$expand=Fields&$select=Name,StringId,fields/TypeAsString Nov 27, 2019 at 14:16
  • I tried it and i obtain results ... but not the one I expect
    – davidvera
    Nov 27, 2019 at 15:54
  • try this /_api/Web/ContentTypes('0x010100ED0CEB986D733A47AD45D9A995911BAA')/Fields Nov 28, 2019 at 7:31

in my case it's ok with : /_api/Web/ContentTypes('0x010100ED0CEB986D733A47AD45D9A995911BAA')/Fields

in ie console, fields details

full code to display contentType fields available here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.