0

I am trying to create a calendar list using SPFx feature framework. Am able to create custom list with content types but Calendar list is not getting created.

XML for fields

<Field ID="{2C665F80-57EA-4632-9CB3-BF85F4DEA4BA}" Group="Test Columns" Type="Text" Name="TestShortDescription" DisplayName="Short Description" Required="TRUE" EnforceUniqueValues="FALSE" Indexed="FALSE" MaxLength="255"></Field>

XML for Content type

<ContentType ID="0x010200D4BB8D5EA0B04541A030DCFE2B96BE49"
        Name="Events"
        Group="Test Content Types"
        Description="Content type used for Events business object">
    <FieldRefs>            
        <FieldRef ID="{2C665F80-57EA-4632-9CB3-BF85F4DEA4BA}" />
    </FieldRefs>
</ContentType>

XML for list

<ListInstance
                CustomSchema="Events.xml"
                FeatureId="00bfea71-de22-43b2-a848-c05709900100"
                Title="Events"
                Description="Events"
                TemplateType="106"
                Url="Lists/Events">
</ListInstance>

XML for list schema

<List xmlns:ows="Microsoft SharePoint" Title="Events" Type="106" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Events" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
      <MetaData>
        <ContentTypes>
          <ContentTypeRef ID="0x010200D4BB8D5EA0B04541A030DCFE2B96BE49" />
        </ContentTypes>
        <Fields></Fields>
        <Views>
          <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
            <XslLink Default="TRUE">main.xsl</XslLink>
            <JSLink>clienttemplates.js</JSLink>
            <RowLimit Paged="TRUE">30</RowLimit>
            <Toolbar Type="Standard" />
            <ViewFields>
              <FieldRef Name="ID"></FieldRef>
            </ViewFields>
            <Query>
              <OrderBy>
                <FieldRef Name="ID" />
              </OrderBy>
            </Query>
          </View>
        </Views>
        <Forms>
          <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
          <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
          <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
        </Forms>
      </MetaData>
    </List>

Reference

  1. Provision SharePoint assets from your SharePoint client-side web part
  2. List element
2
  • is there some kind of an error that you receive as an anwer?
    – jimas13
    Sep 14, 2021 at 9:47
  • Yes while trying to add spfx app to site contents, it says Something went wrong and app is not getting added Sep 14, 2021 at 12:31

1 Answer 1

0

While technically this should work, as you're finding it's a nightmare trying to find where there's an error in the XML since it's a black box. This is why you've seen so little effort invested in this space in years from Microsoft & rather, investments in REST & site designs/scripts.

In fact, MSFT was torn on even supporting this in SPFx. The guidance to provision assets is that you should use the SharePoint REST API or the site designs/site scripts for creating resources.

Your Answer

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

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