No ratings

When trying to add the url on AppDeployment.exe, an error appears


When trying to add the url on AppDeployment.exe, an error appears

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
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.


When trying to access the url on App Deployment http://{ServerName}/autodiscover/api/metadatadocument/test, an error appears.


When adding a URL to K2 for Sharepoint Activation it prompts the error below:

Endpoint cannot be reached : http://{ServerName}/autodiscover/api/metadatadocument/test


Ensure that you can browse to the endpoint from this location.



To resolve this issue, please do the following:

- A full K2 database backup must be taken before you start.

- Also ensure that you the backup web.config file for workspace site - c:\Program Files (x86)\K2 BlackPearl\Workspace\site\web.config


Steps to repair K2 OAuth


1. On the SharePoint Server, run the following PowerShell scripts as SharePoint Administrator:

• Remove-SPTrustedSecurityTokenIssuer -Id "K2 for SharePoint"

• Remove-SPTrustedRootAuthority -Id "K2 for SharePoint"


2. Then check to see that the Providers were deleted (there should be NO K2 High Auth Certificates for K2 for SharePoint)

• Get-SPTrustedSecurityTokenIssuer

• Get-SPTrustedRootAuthority


3. Then on the SQL server where the K2 DB is, run the following:

• DELETE FROM [K2].[HostServer].[Configuration] WHERE VariableToken like '[[]K2_SIGN%'

• TRUNCATE TABLE [K2].[Authorization].[OAuthAppOnlyToken]


4. Then run the following scripts to ensure it had been removed:

• SELECT * FROM [K2].[HostServer].[Configuration] WHERE VariableToken like '[[]K2_SIGN%'

• SELECT * FROM [K2].[Authorization].[OAuthAppOnlyToken]


5. Next, remove the K2 Certificate from the installation folder because you will be generating a new one:

• Program Files (x86)\K2 blackpearl\Host Server\Bin\OAuth\Certificates


6. Run a K2 BlackPearl Reconfigure from installation Media (This is where you installed K2 Blackpearl from originally, remember to make a backup of the workspace config file.)


7. Check to see if a new Token and certificates were generated.

• Program Files (x86)\K2 blackpearl\Host Server\Bin\OAuth\Certificates

• SELECT * FROM [K2].[HostServer].[Configuration] WHERE VariableToken like '[[]K2_SIGN%'

• SELECT * FROM [K2].[Authorization].[OAuthAppOnlyToken]


8. On the SharePoint Server as Farm Administrator, Run the AppDeployment.exe (remember that the user you run it as, has to have rights on the K2 DB to be able to retrieve the certificate).


Next, Run the AppDeployment.exe to added the K2 For Sharepoint application. After adding in the URL of K2 the issue should be resolved and K2 for SharePoint will be added as expected.

Labels: (1)
Version history
Last update:
‎05-20-2021 09:03 AM
Updated by: