pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

The target view cannot be configured as a mobile view.

Open PedroMordeP opened this issue 2 years ago • 3 comments

Category

  • [x] Bug

When deploying a template with a list view with parameters MobileView="TRUE" and Type="GRID" gives a ServerException.

If the MobileView is changed to "False" or the Type to "HTML" it works. Like

  • MobileView="FALSE" and Type="GRID"
  • MobileView="TRUE" and Type="HTML"

Is there any reason why this is not accepted?

Example

<View Name="{DAB0E315-6F4A-412C-9287-285F67B3B482}" MobileView="TRUE" Type="GRID" DisplayName="All Items" Url="{site}/Lists/Event Itinerary/All Items.aspx" Level="1" ContentTypeID="0x">
              <Query />
              <ViewFields>
                <FieldRef Name="LinkTitle" />
                <FieldRef Name="SessionCode" />
                <FieldRef Name="SessionType" />
                <FieldRef Name="Description" />
                <FieldRef Name="Speakers" />
                <FieldRef Name="StartDateAndTime" />
                <FieldRef Name="EndDateAndTime" />
                <FieldRef Name="Duration" />
                <FieldRef Name="Capacity" />
                <FieldRef Name="Location" />
                <FieldRef Name="Notes" />
              </ViewFields>
              <RowLimit Paged="TRUE">30</RowLimit>
              <CustomFormatter><![CDATA[
{
	"additionalRowClass": {
		"operator": ":",
		"operands": [{
			"operator": "==",
			"operands": [{
				"operator": "%",
				"operands": ["@rowIndex", 2]
			}, 0]
		}, "sp-css-backgroundColor-neutralBackground", {
			"operator": ":",
			"operands": [{
				"operator": "==",
				"operands": [{
					"operator": "%",
					"operands": ["@rowIndex", 2]
				}, 1]
			}, "", ""]
		}]
	},
	"rowClassTemplateId": "BgColorAlternateRows"
}]]></CustomFormatter>

Error

(ServerException) The target view cannot be configured as a mobile view.

 --- Server Error Details:
 - ServerErrorCode: -2146232832
 - ServerErrorTraceCorrelationId: 4d94b8a0-908a-6000-a328-75f154a12cc7
 - ServerErrorTypeName: Microsoft.SharePoint.SPException
 - Source: Microsoft.SharePoint.Client.Runtime

 --- StackTrace:    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateView(Web web, View view, ViewCollection existingViews, List createdList, PnPMonitoredScope monitoredScope, TokenParser parser, Int32 currentViewIndex, Int32 total)
    at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProcessViews(Web web, TokenParser parser, PnPMonitoredScope scope, ListInfo listInfo)
    at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
    at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)

PedroMordeP avatar Jun 01 '23 14:06 PedroMordeP

@PedroMordeP : this seems to be an issue coming via PnP Framework (as I see the provisioning engine code paths). This feels like a SharePoint issue and not an issue in the SDK's

jansenbe avatar Jun 01 '23 17:06 jansenbe

@PedroMordeP : this seems to be an issue coming via PnP Framework (as I see the provisioning engine code paths). This feels like a SharePoint issue and not an issue in the SDK's

Since the issue was coming from SharePoint server I thought to ask on the PnP.Core repository if someone already had this issue.

I marked it as a bug but what I really want to know is if is there anything I do to try to solve it.

At this moment o set the MobileView to "FALSE" just to deploy without the issue.

Thank you @jansenbe

PedroMordeP avatar Jun 02 '23 09:06 PedroMordeP

@PedroMordeP I ended up following your suggestion of setting the 'MobileView' to 'FALSE', but it still gives an error: "The target view cannot be configured as a mobile view."

There is another property in the schema, 'MobileDefaultView', which was set to 'TRUE'. I had to set that one to 'FALSE' to deploy it successfully.

With this said, I changed both properties, 'MobileView' and 'MobileDefaultView', from 'TRUE' to 'FALSE'.

vascoazevedo08 avatar Jul 15 '24 09:07 vascoazevedo08