sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Adding multiple list views with feature deployment breaks the list

Open EA12 opened this issue 1 year ago β€’ 5 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

πŸ’₯ SharePoint Framework

Developer environment

None

What browser(s) / client(s) have you tested

  • [ ] πŸ’₯ Internet Explorer
  • [X] πŸ’₯ Microsoft Edge
  • [ ] πŸ’₯ Google Chrome
  • [ ] πŸ’₯ FireFox
  • [ ] πŸ’₯ Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version 126.0.2592.113 (Official build) (64-bit)
  • SPFx version 1.18.2
  • Node.js version 18.19.0

Describe the bug / error

If you open the default view, you see an error message.

image

If you navigate to the list settings, you see an error.

image

If you the the url to open the second view, you see "Error" on the Browser-Tab and errors in the console.

image

It may has to do with the new list layout?

image

The elements.xml:

<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Field ID="{4d6e9ca0-d0c3-4686-8c2c-ea0dcfb4bc63}" Name="Title_EN" DisplayName="Title_EN" Type="Text" Group="ABC" /> <ContentType ID="0x010085586ab8fc79479ba6eceb515b334002" Name="CustomTest" Group="ABC" Description="Create" Inherits="FALSE"> <FieldRefs> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="FALSE"/> <FieldRef ID="{4d6e9ca0-d0c3-4686-8c2c-ea0dcfb4bc63}" Name="Title_EN" /> </FieldRefs> </ContentType> <ListInstance CustomSchema="TestSchema.xml" FeatureId="00bfea71-de22-43b2-a848-c05709900100" Title="Test" Description="Multiple views test." TemplateType="100" Url="Lists/Test"> </ListInstance> </Elements>

And the TestSchema.xml:

<List xmlns:ows="Microsoft SharePoint" Title="Test" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Test" BaseType="0" RootWebOnly="FALSE" xmlns="http://schemas.microsoft.com/sharepoint/"> <MetaData> <ContentTypes> <ContentTypeRef ID="0x010085586ab8fc79479ba6eceb515b334002" /> </ContentTypes> <Fields></Fields> <Views> <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="First" 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="Title"></FieldRef> </ViewFields> <Query> <OrderBy> <FieldRef Name="ID" Ascending="FALSE" /> </OrderBy> </Query> </View> <View BaseViewID="2" Type="HTML" WebPartZoneID="Main" DisplayName="Second" DefaultView="FALSE" MobileView="TRUE" MobileDefaultView="FALSE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="Second.aspx"> <XslLink Default="TRUE">main.xsl</XslLink> <JSLink>clienttemplates.js</JSLink> <RowLimit Paged="TRUE">30</RowLimit> <Toolbar Type="Standard" /> <ViewFields> <FieldRef Name="Title"></FieldRef> <FieldRef Name="Title_EN"></FieldRef> </ViewFields> <Query> <OrderBy> <FieldRef Name="ID" Ascending="TRUE" /> </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>

From my package-solution.json:

"features": [ { "title": "views Feature", "description": "The feature that activates elements of the views solution.", "id": "5ebe2b32-9764-44e4-80d7-a77dab51ce38", "version": "1.0.0.0", "assets": { "elementManifests": [ "elements.xml" ], "elementFiles": [ "TestSchema.xml" ] } } ]

Please have a look into it. - Thanks.

Steps to reproduce

  1. Create a new webpart project with react.
  2. Add an elements.xml to deploy a custom field (text), a content type and a list.
  3. Add a schema.xml for the list and include two views.
  4. deploy the solution and add the app

Expected behavior

Both views should be valid

EA12 avatar Jul 29 '24 09:07 EA12

Can you please have a look into it? - Thanks!

EA12 avatar Aug 05 '24 12:08 EA12

Still nobody?

EA12 avatar Aug 15 '24 11:08 EA12

I know, everybody has a lot to do, but this is blocking us... Please help... - Thanks!

EA12 avatar Aug 26 '24 17:08 EA12

After 5 weeks, still no answer :(

EA12 avatar Sep 04 '24 07:09 EA12

October now, still nobody had a look into it? Nobody else is using feature deployment with multiple views?

EA12 avatar Oct 12 '24 11:10 EA12

End of November now, still nobody had a look into it?

EA12 avatar Nov 26 '24 11:11 EA12

December now and still nobody else is complaining about that. So it seems that everybody else is installing multiple views in a post deployment scenario or even manually? - Please MS, have a look into it. - Thanks!

EA12 avatar Dec 17 '24 16:12 EA12

Hello @EA12, Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

Ashlesha-MSFT avatar May 21 '25 19:05 Ashlesha-MSFT

@EA12 , While creating a .sppkg (SharePoint Framework solution package) file, I received the following warning: Warning - [package-solution] Admins can make this solution available to all sites immediately, but the solution also contains feature.xml elements for provisioning. Feature.xml elements are not automatically applied unless the solution is explicitly installed on a site.

Despite this warning, the .sppkg file was successfully generated and uploaded to the App Catalog. However, when attempting to add the web part to a SharePoint page, no error message is shown in the browser or developer tools.

Could you please let me know if I’m missing any steps in the testing process?

Ashlesha-MSFT avatar May 22 '25 11:05 Ashlesha-MSFT

@Ashlesha-MSFT ,

thanks for diggin in to it. The menntioned warning has nothing to do with the issue. Please navigate to the list (which you deployed with the solution) and you will see the error. Please read my Steps to reproduce.

Thx, Ronny

EA12 avatar May 22 '25 12:05 EA12

@EA12, We were able to reproduce the issue. Could you please take a moment to review the details below to get an idea of the possible root cause and help identify any next steps? https://github.com/SharePoint/sp-dev-docs/issues/8508 Image

Ashlesha-MSFT avatar May 23 '25 07:05 Ashlesha-MSFT

@Ashlesha-MSFT ,

I don't think the fields thing from 8508 has something to do with the multiple views issue, but i double checked and added my fields from the elements.xml also to the schema:

Image

Even with a fresh redeployment (I removed everything before), i get the same errors.

I can get a result from the API: /_api/web/lists/getbytitle('Test') When I try to get the Views by API, i get the typical unspecific error: /_api/web/lists/getbytitle('Test')/views

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-2147467259, Microsoft.SharePoint.SPException</m:code> <m:message xml:lang="de-DE">Der Vorgang kann nicht erfolgreich beendet werden. Bitte versuchen Sie es erneut.</m:message> </m:error>

Cheers, Ronny

EA12 avatar May 23 '25 09:05 EA12

@EA12, Thanks for the detailed update. It’s helpful to know that the list itself is accessible via the API, but the /views endpoint is still returning a generic SPException, even after a clean redeployment.

Could you please let us know if you're satisfied with the current behavior, or if this is still blocking your intended use case?

Ashlesha-MSFT avatar May 23 '25 10:05 Ashlesha-MSFT

@Ashlesha-MSFT ,

no, how could I be satisfied? We cannot deploy multiple views to lists with feature deployment. It should be possible as from your schema definitions: https://learn.microsoft.com/en-us/sharepoint/dev/schema/views-element-list https://learn.microsoft.com/en-us/sharepoint/dev/schema/view-element-list

EA12 avatar May 23 '25 10:05 EA12

@EA12,

As We were able to reproduce the issue, and we are investigating it. We have logged this as a bug, and our engineering team will look into it. Thank you for your patience!

Ashlesha-MSFT avatar May 23 '25 11:05 Ashlesha-MSFT

@EA12 - Looking on the definition you shared, second view is assuming second.aspx as the URL to serve the content. AllItems.aspx is there by default which in the modern experiences works for all views - simply the view ID is adjusted in the query parameter.

So - for the second view - you have a Url attribute assigned as "Second.aspx". Depending on your provisioning logic and outcome, you might potentially have the Second.aspx in the package - but that would be so called classic list experience with views.

Image

Now - looking on the my use case - I exported the schema.xml from the live site (above picture) and checked the current setup on that. Notice how the path includes site relative path, not just the view aspx page. Most likely this is the key reason for your rendering to fail - as there's no such page to access when you go the second page.

Image

This classic feature framework provisioning is challenging - and complicated for sure - super low level stuff from 2003 version forward, so old stuff.

How did I export the list schema definition for the sample case? - Used following trick under the site URL - /_vti_bin/owssvr.dll?Cmd=ExportList&List={5cbcac6f-df35-4cc2-92c1-cbc5dabfa93c}

That GUIID is then the unique GUID of the list - which could get from the list settings page - in URL address bar.

Provisioning multiple views is complicated for sure. Without access on the exact solution structure and insights on there - this is pretty much the best can do to push you to the right direction on resolving this.

VesaJuvonen avatar Aug 21 '25 15:08 VesaJuvonen

Answered- and not really an issue for SPFx. - We are closing this issue for now due to inactivity from the developer.

Ashlesha-MSFT avatar Oct 24 '25 10:10 Ashlesha-MSFT