Web Integration

Web Integration


Konzept

primedocs web allows to integrate the primedocs templates into other web applications.

Microsoft SharePoint

primedocs can be called directly from a SharePoint document library. The primedocs SharePoint App integrates into the toolbar:

primedocs Integration in SharePoint toolbar

The toolbar button takes you to the primedocs web application, which now stores all documents directly in the respective SharePoint list:

primedocs web in SharePoint mode

Technical details

For the configuration, a list primedocsSettings is stored in the SharePoint "root" with an element TemplatePickerUrl, which points to https://{INSTANCE-NAME}/app/web/sharepoint.

The installed SharePoint app adds more parameters (saveLocationSharePointSiteId, saveLocationSharePointSiteName, saveLocationSharePointFolderPath, saveLocationSharePointListId, saveLocationSharePointListName, saveLocationSharePointUrl) to the configured url when the button is triggered so that primedocs web can place the documents in the correct document library.

The Azure AD app requires the scopes: Sites.Read.All, Files.ReadWrite.All.

Microsoft Teams

primedocs can be accessed directly in Teams via the web integration.

image-20240523-150800.png

The Teams app must be installed for this: TODO: MS Teams App Install

CMI

The following is required for integration into the CMI product:

Version 24.0 or a newer version is installed.

In the CMI, primedocs must be registered as an application (Scope templateManager) and the ClientId and ClientSecret are required.

This data must then be stored in primedocs.config:

<primedocs ...> ... <cmi tokenEndpointHost="https://[sts-cmihost.com]" uploadEndpointHost="https://[cmihost.com]" clientId="[Client Id von CMI]" clientSecret="[Client Secret von CMI]" /> ... </primedocs>

You can find a demonstration of this integration on our YouTube Channel.

The configuration for the hosted CMI version usually looks like this:

<primedocs ...> ... <cmi tokenEndpointHost="https://sts3.prod.cmicloud.ch" uploadEndpointHost="https://docintegration-template.prod.cmicloud.ch" clientId="[Client Id von CMI]" clientSecret="[Client Secret von CMI]" /> ... </primedocs>

 

Important: The “Tenant” is automatically transferred via the CMI integration and must therefore not be configured, otherwise the URL will be composed incorrectly.

Integrating CMI data into templates

If you want to display data from CMI in primedocs templates, you can use these as placeholders via Word PlainText Content Controls with the naming scheme CMI_[FELDNAME] or bookmarks can also be used. Both the content controls with the CMI naming and bookmarks are automatically filled with the correct content by CMI.

Technical Details

When the primedocs “template picker” is selected, an iFrame is created which points to the primedocs web application.
The parameters saveLocationCmiTenant and saveLocationCmiToken are also specified. In the simplest case, the CMI application generates such an iFrame:

<iframe src="https://{INSTANCE-NAME}/app/web/cmi?saveLocationCmiTenant=[CMI-Tenant]&saveLocationCmiToken=[CMI-Token]" style="height: 700px; width: 700px; border: 1px solid;"> </iframe>

Once the document has been created, it is automatically uploaded to the uploadEndpointHost.

The following intermediate steps take place during the upload:

  • An AccessToken is requested from the [tokenEndpointHost]/[CMI-Tenant]/identity/connect/token with the scope templateManager via client_credentials using the ClientId and ClientSecret.

  • The AccessToken is attached to [uploadEndpointHost]/[CMI-Tenant]/Template/[CMI-Token] for the file upload and the upload is executed via HTTP POST.

After the upload, this object is delivered to CMI via Javascript so that the process can be continued in CMI.

window.parent.postMessage({ type: "template-chooser-document-uploaded", name: result.name, }, "*");

 

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland