K2 for SharePoint: Save Site as Template may not work as expected

  • 24 February 2022
  • 0 replies
  • 41 views

Userlevel 2
Badge +9
 

K2 for SharePoint: Save Site as Template may not work as expected

KB001619

PRODUCT
K2 blackpearl 4.6.9 to 4.6.11
BASED ON
K2 blackpearl 4.6.9
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Issue Description

When attempting to save a SharePoint 2013 site as a template, and that site has K2 for SharePoint integration, you will receive a "Sorry, something went wrong" error. Additional error information may include a message like "Sorry, this site cannot be saved as a template. It contains apps that don't work in templates".

Note: With Appit 1.4, due to the way in which the K2 for SharePoint app is deployed, the error no longer exists when creating a site template unless you have a 3rd-party app that blocks the saving of a site template.

 

 

Cause

This is a known issue with SharePoint 2013 sites that have apps installed: see the Microsoft KB article  “Sorry, something went wrong” error when you try to save a site as a template in SharePoint Online (http://support.microsoft.com/kb/2885566) for more information. Site template (*.wsp) files cannot currently store site definitions that contain apps. To successfully save the site as a template, you will need to remove the K2 for SharePoint app (and potentially other 3rd-party apps as well) from the site before saving it as a template

Resolution

To save such sites as site templates, you will need to remove the K2 for SharePoint app from the site. See the section Removing the K2 for SharePoint App from a site for instructions.
If (and only if) a workflow in your application uses SharePoint events to start the workflow, you will need to perform additional steps: see the section Workflows that start based on SharePoint Events for additional steps.

You may have to remove other 3rd-party apps from the site as well before you will be able to save the site as a template.
Removing the K2 for SharePoint App from a site
  1. Open the Site Contents page by clicking Settings > Site Contents on the site
  2. Click the ellipse button on the K2 blackpearl for SharePoint  or the K2 Appit for SharePoint app, and then click the Remove link as shown in the following image:
    Image
  3. Save the site as a template. (You can now create new sites based on this template)
  4. Add the K2 for SharePoint app back to the site by clicking Settings > Add an App and then running through the K2 registration wizard.

Note that removing the K2 for SharePoint app from a site does not remove any application elements (Data, Forms, Workflows or Reports) from your K2 environment. Once you have added the K2 App back to your site, your K2 application should continue to function as it did before you removed the K2 for SharePoint app.

Workflows that start based on SharePoint Events

Important: This problem has been fixed in SharePoint Online version 16.0.4120.1200 or greater. To check the version of your SharePoint Online instance browse to https://[root site URL]/_vti_pvt/buildversion.cnf.

At the moment this fix has not been released as an update to SharePoint 2013. When it is this note will be updated.

With this SharePoint Online fix, in the Option 1 workaround below, you must remove the app but you do not have to uninstall it first - you can skip step 3 below.

If you selected any of the "when the following events occur" options (except for Workflow is manually started) to start a workflow in your K2 application based on an event in SharePoint, you will need to follow a slightly different procedure because K2 makes use of Remote Event Receivers to start workflows based on these events.
Image
The underlying issue is that the current K2 server endpoint address will be associated with the Remote Event Receivers (RERs). When you save the site as a template, SharePoint will save the current K2 server endpoint as the endpoint to be called for all sites created based on this template. This is not a desired outcome in the majority of the Save Site as Template use cases, since you may want the RERs to point to different K2 environments. A good example is when you want to move a Site from Development to Production: in this case, you do not want the migrated Site to start workflows in your Development environment, therefore the RERs will need to be removed from the Site template. There are a few different ways in which you can remove the RERs from a wsp:

Option 1: Uninstall the K2 Application to remove the RERs
      1. Package any existing K2 application elements using the K2 Package & Deployment tools. It is recommended to create a package per application.
      2. Open the Site Contents page by clicking Settings > Site Contents on the site
      3. Uninstall the K2 for SharePoint application by using the Settings page in K2 for SharePoint
        Image
      4. Click the ellipse button on the K2 for SharePoint app, and then click the Remove link as show in the following image:
        Image
      5. Save the site as a template
      6. Install the K2 app to the site again by clicking Add an App from the Settings menu and run through the Registration Wizard
      7. Deploy the package created in step 1 to the site. You may find that the objects still exist on the server: that is ok, simply deploy the package again to re-link the objects to the list/libraries.


Option 2: Use 3rd-party tools to remove the RERs
      1. Use a 3rd party tool such as SharePoint Manager or SharePoint Client Browser to remove the RERs from the Lists/Libraries where RERs have been registered
      2. Follow the steps in the Removing the K2 for SharePoint App from a site section to remove the K2 App, save the site as a template and then re-add the K2 for SharePoint App to the site

Errors

The following errors may occur if you do not follow the above steps:

      • Sorry, something went wrong
      • Sorry, this site cannot be saved as a template. It contains apps that don't work in templates: K2 Appit for SharePoint, K2 blackpearl for SharePoint, etc.
      • K2 Package & Deployment Error: You may receive the following error on deployment:
      • Access denied: You do not have permission to perform this action.

 


0 replies

Be the first to reply!

Reply