sp-dev-docs
sp-dev-docs copied to clipboard
Custom Action Locations
Documentation states that NewFormToolbar
is a valid location (along with several reference books), however when deploying it to SharePoint online it states that the location is invalid.
Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="965225e0-662b-4089-acdc-78433528f646.TestMenuAction"
RegistrationType="List"
RegistrationId="{$ListId:Lists/Add-in List Test;}"
Location="NewFormToolbar"
Sequence="10"
Title="Search Patients">
<!--
Update the Url below to the page you want the custom action to use.
Start the URL with the token ~remoteAppUrl if the page is in the
associated web project, use ~appWebUrl if page is in the app project.
-->
<UrlAction Url="~appWebUrl/Pages/LookupWebPart.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}" />
</CustomAction>
</Elements>
Error:
@"Error 1
CorrelationId: 817f7325-e9bc-41da-ae9f-400b459ce1cf
ErrorDetail: There were problems with the app web definition in the package.
ErrorType: App
ErrorTypeName: App Related
ExceptionMessage: Deployment failed in host web https://<redacted>.sharepoint.com/sites/dev.addin for app <redacted>/ca27c77f-c56f-409d-a69d-7064091fdda4. Microsoft.SharePoint.SPException: Feature definition with Id ca27c77f-c56f-409d-a69d-7064091fdda5 failed validation, file '/elements33b5f3d1-0607-455b-b292-880b39ec127d.xml', line 6, character 17: The 'Location' attribute is invalid - The value 'NewFormToolbar' is invalid according to its datatype 'http://schemas.microsoft.com/sharepoint/:CustomActionLocations' - The Enumeration constraint failed.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 30a71f46-2815-dce8-4bdc-24932eaa0c4c
- Version Independent ID: a57aa940-c73b-98b6-804f-c8be173bfe60
- Content: Default Custom Action Locations and IDs
- Content Source: docs/schema/default-custom-action-locations-and-ids.md
- Service: sharepoint-online
- GitHub Login: @VesaJuvonen
- Microsoft Alias: vesaj
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
According to the schema there are only two supported locations:
- CommandUI.Ribbon
- EditControlBlock
This also means the documentation on https://docs.microsoft.com/en-us/sharepoint/dev/schema/customaction-element is incorrect (and countless printed books on this topic!).
Was this a recent change for SPO, or just a limitation on AppHosted features? Should the documentation be updated to reflect this?
EDIT: looks like some of this has been documented on https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/sharepoint-add-ins-ux-design-guidelines#adding-custom-actions-to-the-host-web