Reputation: 340
I created a list in a SharePoint 2013 App and the Schema.xml contains the following node related to the AllItems view.
<View BaseViewID="1"
Type="HTML"
WebPartZoneID="Main"
DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;"
DefaultView="TRUE"
OrderedView="TRUE"
MobileView="TRUE"
MobileDefaultView="TRUE"
SetupPath="pages\viewpage.aspx"
ImageUrl="/_layouts/15/images/generic.png?rev=23"
Url="AllItems.aspx">
I'd like to replace SetupPath="pages\viewpage.aspx
with my own page, so I can brand it as per my client's requirements. I've already created my Pages\CustomViewPage.aspx
, but I cannot figure out how to reference my custom page.
I've tried the following attributes. I replaced SetupPath
with Path
, see View Element (List):
<View BaseViewID="1"
Type="HTML"
WebPartZoneID="Main"
DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;"
DefaultView="TRUE"
OrderedView="TRUE"
MobileView="TRUE"
MobileDefaultView="TRUE"
Path="~site/pages/customviewpage.aspx"
ImageUrl="/_layouts/15/images/generic.png?rev=23"
Url="AllItems.aspx">
If I use Path="~site/pages/customviewpage.aspx"
or Path="../pages/customviewpage.aspx"
, the application cannot be deployed and the error is not very helpful (SharePoint Online):
@"Error 1
CorrelationId: aedf6556-ac09-4b0e-9367-905c81563a57
ErrorDetail: There was a problem with activating the app web definition.
ErrorType: App
ErrorTypeName: App Related
ExceptionMessage: <nativehr>0x80131600</nativehr><nativestack></nativestack>
Source: AppWeb
SourceName: App Web Deployment
Error occurred in deployment step 'Install app for SharePoint':
Failed to install app for SharePoint. Please see the output window for details.
If you know how to reference your own custom ListView page, please drop me a line. Thank you.
Upvotes: 0
Views: 1090
Reputation: 84
Yes. All the view pages inside SharePoint List is created directly under the SharePoint List path. The Pages library is meant for the current site scope. You cannot use the Pages library pages as the list view page. It's the relative path issue and whatever you have implemented is correct!
Upvotes: 0
Reputation: 340
I found a workaround, it's not exactly what I was looking for, but it will do for now.
Pages\CustomViewPage.aspx
under the folder Pages
, then I moved my custom page to Lists\MyList\CustomViewPage.aspx
.Lists\MyList\CustomViewPage.aspx
and select Properties. Then set the View
tag as follows. Please note the attribute SetupPath
was replaced with Path
:
<View BaseViewID="1"
Type="HTML"
WebPartZoneID="Main"
DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;"
DefaultView="TRUE"
OrderedView="TRUE"
MobileView="TRUE"
MobileDefaultView="TRUE"
Path="customviewpage.aspx"
ImageUrl="/_layouts/15/images/generic.png?rev=23"
Url="AllItems.aspx">
It's obvious the issue was related to the path which was incorrect. The workaround above places the custom form in the same folder as the list. If you know a way to reference a file on another folder, please drop me a line.
Upvotes: 0