SharePointDsc icon indicating copy to clipboard operation
SharePointDsc copied to clipboard

SP_ContentType - New Resource Proposal

Open kilasuit opened this issue 4 years ago • 4 comments

Description

Way to provision Content Types in Content Type Hub or Sites

Proposed properties

Name SchemaXML

Special considerations or limitations

Would also require Site Column Resource to be created - see #1337

kilasuit avatar Jul 21 '21 10:07 kilasuit

Note: Use of SchemaXml and not all other properties that Content Type objects could take is to reduce the overhead in development and is often used cross on-premises & online with CSOM so should allow developers (or admins) to easily use this where they deem it fit to do so

kilasuit avatar Jul 21 '21 11:07 kilasuit

Usually SharePointDsc focusses on infrastructure components, not content. This because editing content can result in a conflict with user edits (e.g. a user edits the title of a site and your desired state is no longer compliant). This resource is a grey area. I like your idea to also allow managing the Content Type Hub, which is something end users are unable to edit. That is why I think this resource is a valuable one.

Do you have an example of the SchemaXML?

ykuijs avatar Jul 24 '21 11:07 ykuijs

Example of the SchemaXML for the built-in Item ContentType (taken from my SharePoint Online tenant)

<ContentType ID="0x01" Name="Item" Group="List Content Types" Description="Create a new list item." Version="0" FeatureId="{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}">
    <Folder TargetName="_cts/Item" />
    <Fields>
        <Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" DelayActivateTemplateBinding="GROUP,SPSPERS,SITEPAGEPUBLISHING" Customization="">
            <FieldRefs>
                <FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
            </FieldRefs>
            <DisplayPattern>
                <MapToContentType>
                    <Column Name="ContentTypeId" />
                </MapToContentType>
            </DisplayPattern>
        </Field>
        <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" DelayActivateTemplateBinding="GROUP,SPSPERS,SITEPAGEPUBLISHING" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE"></Field>
    </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>

kilasuit avatar Jul 26 '21 00:07 kilasuit

@ykuijs - If you can assign this to me I will work on implementing this next month or so.

kilasuit avatar Aug 05 '21 12:08 kilasuit