Fix: K2 Legacy Apps Error "Application does not have permissions to upload pages"

If you are running SharePoint Server Subscription Edition (SE) with the K2 Legacy Apps add-in model, you might run into a frustrating roadblock during site activation.

A common error message many admins encounter is:

"The application does not have permissions to upload pages for rendering SmartForms in SharePoint."

This issue isn’t unique to on-premises environments; it behaves identically to a known limitation in SharePoint Online regarding "Custom Script" permissions. Here is why it happens and how to fix it using PowerShell.

Why is this happening?

By default, modern SharePoint site collections often have a security setting enabled called the DenyPermissionsMask. Specifically, the flag for AddAndCustomizePages is frequently blocked.

Because K2 needs to upload specific pages to your SharePoint site to render SmartForms, this security restriction blocks the app from completing the deployment. To get past this, we need to temporarily lift the restriction, activate the K2 app, and then re-enable the security mask.

The Solution: Updating the DenyPermissionsMask

To resolve this, you will need to run a few lines of PowerShell on your SharePoint server. Ensure you are running the SharePoint Management Shell as an Administrator.

1. Check the Current Status

First, let’s verify if the restriction is actually in place. Replace the URL with your specific site collection URL.

# Get Current DenyPermissionsMask
# If it returns "AddAndCustomizePages", the restriction is active.
(Get-SPSite -Identity "https://your-sharepoint-site.com").DenyPermissionsMask

2. Remove the Restriction

To allow K2 to upload the necessary SmartForm pages, set the mask to EmptyMask.

# Update to emptyMask to allow page uploads
(Get-SPSite -Identity "https://your-sharepoint-site.com").DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

3. Activate K2

Now that the permissions are open, go back to your K2 for SharePoint app and run the Manage App Activations wizard. It should now complete without the "permissions to upload pages" error.

4. Re-enable Security (Optional but Recommended)

Once the activation is successful, it is a best practice to restore the original security settings to prevent unauthorized script or page uploads.

# Set it back to AddAndCustomizePages to secure the site
(Get-SPSite -Identity "https://your-sharepoint-site.com").DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::AddAndCustomizePages

Relevant: SharePoint Online

Comments

Popular posts from this blog

Blocking Error during K2 5.6 Server migration

Client Credentials flow with K2 Cloud with Odata, Workflow REST or SCIM

Blocking error RegisterServiceInstanceObjects when upgrading to K2 5.6/5.7