Currently, we can list content types in sites and lists, but when using quite some content types that inherit from the same content type (e.g. Site Page X inherits from Site Page Y which inherits from Site Page), it can become really difficult to check which content type inherits from which.
I suggest that we enhance the output with the Parent property. This way the user can easily check which content type inherits from which.
Commands to update:
API:
GET https://contoso.sharepoint.com/sites/playground/Lists('<Guid>')/ContentTypes?$expand=Parent
Since Parent returns the entire content type of the parent, I suggest we only retrieve properties Id, StringId, Name, Group.
Output would look something like this:
[
{
"Parent": {
"StringId": "0x01000B1208C5D23DF",
"Name": "Item",
"Group": "List items",
"Id": { "StringId": "0x01000B1208C5D23DF" },
},
"ClientFormCustomFormatter": "",
"Description": "Create a new list item.",
"DisplayFormClientSideComponentId": "",
"DisplayFormClientSideComponentProperties": "",
"DisplayFormTarget": 0,
"DisplayFormTemplateName": "ListForm",
"DisplayFormUrl": "",
"DocumentTemplate": "",
"DocumentTemplateUrl": "",
"EditFormClientSideComponentId": "",
"EditFormClientSideComponentProperties": "",
"EditFormTarget": 0,
"EditFormTemplateName": "ListForm",
"EditFormUrl": "",
"Group": "List Content Types",
"Hidden": false,
"Id": {
"StringValue": "0x01000B1208C5D23DF44B9F1AEE7373DE9D5E"
},
"JSLink": "",
"MobileDisplayFormUrl": "",
"MobileEditFormUrl": "",
"MobileNewFormUrl": "",
"Name": "Item",
"NewFormClientSideComponentId": null,
"NewFormClientSideComponentProperties": "",
"NewFormTarget": 0,
"NewFormTemplateName": "ListForm",
"NewFormUrl": "",
"ReadOnly": false,
"SchemaXml": "<ContentType ID=\"0x01000B1208C5D23DF44B9F1AEE7373DE9D5E\" Name=\"Item\" Group=\"List Content Types\" Description=\"Create a new list item.\" Version=\"0\" FeatureId=\"{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}\" FeatureIds=\"{695b6570-a48b-4a8e-8ea5-26ea7fc1d162};{c94c1702-30a7-454c-be15-5a895223428d}\"><Folder TargetName=\"Item\"/><Fields><Field ID=\"{c042a256-787d-4a6f-8a8a-cf6ab767f12d}\" Type=\"Computed\" DisplayName=\"Content Type\" Name=\"ContentType\" DisplaceOnUpgrade=\"TRUE\" RenderXMLUsingPattern=\"TRUE\" Sortable=\"FALSE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"ContentType\" Group=\"_Hidden\" PITarget=\"MicrosoftWindowsSharePointServices\" PIAttribute=\"ContentTypeID\" FromBaseType=\"TRUE\"><FieldRefs><FieldRef Name=\"ContentTypeId\"/></FieldRefs><DisplayPattern><MapToContentType><Column Name=\"ContentTypeId\"/></MapToContentType></DisplayPattern></Field><Field ID=\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\" Type=\"Text\" Name=\"Title\" DisplayName=\"Title\" Required=\"TRUE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"Title\" FromBaseType=\"TRUE\" ColName=\"nvarchar1\" ShowInNewForm=\"TRUE\" ShowInEditForm=\"TRUE\"/></Fields><XmlDocuments><XmlDocument NamespaceURI=\"http://schemas.microsoft.com/sharepoint/v3/contenttype/forms\"><FormTemplates xmlns=\"http://schemas.microsoft.com/sharepoint/v3/contenttype/forms\"><Display>ListForm</Display><Edit>ListForm</Edit><New>ListForm</New></FormTemplates></XmlDocument></XmlDocuments></ContentType>",
"Scope": "/Lists/Test",
"Sealed": false,
"StringId": "0x01000B1208C5D23DF44B9F1AEE7373DE9D5E"
}
]
Currently, we can list content types in sites and lists, but when using quite some content types that inherit from the same content type (e.g.
Site Page Xinherits fromSite Page Ywhich inherits fromSite Page), it can become really difficult to check which content type inherits from which.I suggest that we enhance the output with the Parent property. This way the user can easily check which content type inherits from which.
Commands to update:
spo list contenttype listspo contenttype listspo contenttype getAPI:
Since Parent returns the entire content type of the parent, I suggest we only retrieve properties
Id,StringId,Name,Group.Output would look something like this:
[ { "Parent": { "StringId": "0x01000B1208C5D23DF", "Name": "Item", "Group": "List items", "Id": { "StringId": "0x01000B1208C5D23DF" }, }, "ClientFormCustomFormatter": "", "Description": "Create a new list item.", "DisplayFormClientSideComponentId": "", "DisplayFormClientSideComponentProperties": "", "DisplayFormTarget": 0, "DisplayFormTemplateName": "ListForm", "DisplayFormUrl": "", "DocumentTemplate": "", "DocumentTemplateUrl": "", "EditFormClientSideComponentId": "", "EditFormClientSideComponentProperties": "", "EditFormTarget": 0, "EditFormTemplateName": "ListForm", "EditFormUrl": "", "Group": "List Content Types", "Hidden": false, "Id": { "StringValue": "0x01000B1208C5D23DF44B9F1AEE7373DE9D5E" }, "JSLink": "", "MobileDisplayFormUrl": "", "MobileEditFormUrl": "", "MobileNewFormUrl": "", "Name": "Item", "NewFormClientSideComponentId": null, "NewFormClientSideComponentProperties": "", "NewFormTarget": 0, "NewFormTemplateName": "ListForm", "NewFormUrl": "", "ReadOnly": false, "SchemaXml": "<ContentType ID=\"0x01000B1208C5D23DF44B9F1AEE7373DE9D5E\" Name=\"Item\" Group=\"List Content Types\" Description=\"Create a new list item.\" Version=\"0\" FeatureId=\"{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}\" FeatureIds=\"{695b6570-a48b-4a8e-8ea5-26ea7fc1d162};{c94c1702-30a7-454c-be15-5a895223428d}\"><Folder TargetName=\"Item\"/><Fields><Field ID=\"{c042a256-787d-4a6f-8a8a-cf6ab767f12d}\" Type=\"Computed\" DisplayName=\"Content Type\" Name=\"ContentType\" DisplaceOnUpgrade=\"TRUE\" RenderXMLUsingPattern=\"TRUE\" Sortable=\"FALSE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"ContentType\" Group=\"_Hidden\" PITarget=\"MicrosoftWindowsSharePointServices\" PIAttribute=\"ContentTypeID\" FromBaseType=\"TRUE\"><FieldRefs><FieldRef Name=\"ContentTypeId\"/></FieldRefs><DisplayPattern><MapToContentType><Column Name=\"ContentTypeId\"/></MapToContentType></DisplayPattern></Field><Field ID=\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\" Type=\"Text\" Name=\"Title\" DisplayName=\"Title\" Required=\"TRUE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"Title\" FromBaseType=\"TRUE\" ColName=\"nvarchar1\" ShowInNewForm=\"TRUE\" ShowInEditForm=\"TRUE\"/></Fields><XmlDocuments><XmlDocument NamespaceURI=\"http://schemas.microsoft.com/sharepoint/v3/contenttype/forms\"><FormTemplates xmlns=\"http://schemas.microsoft.com/sharepoint/v3/contenttype/forms\"><Display>ListForm</Display><Edit>ListForm</Edit><New>ListForm</New></FormTemplates></XmlDocument></XmlDocuments></ContentType>", "Scope": "/Lists/Test", "Sealed": false, "StringId": "0x01000B1208C5D23DF44B9F1AEE7373DE9D5E" } ]