Skip to main content
Version: 4.1 (2026-H2)

Updating documents

Overview

If Forms-/ Data-values in a document created with primedocs need to be updated, this can be done using DocumentLocation.

note

Important: The original file itself is not changed, instead, it is only read in and can then be saved again, for example, via Connect Commands ( After document generation (Commands) )

“DocumentLocation”

By using the DocumentLocation-element in combination with the Source-attribute, the document does not need to be recreated, meaning that existing customizations in the generated document are retained.

<primedocsConnect>
<DocumentLocation Source="\\MyServer\share\doc\...\documentxyz.docx" />
...
</primedocsConnect>

It is essential that the document was originally created with primedocs. In addition, the user performing the update must have access to the template on which the document was based.

ℹ️ Info It is not possible to change an Author or the DocumentLanguage with this method.

“Source”-Attribute

With the Source-attribute, it is possible to use both a local and a remote source. If a remote source is used, it is essential to enable it beforehand in DatasourceAdmin under ConnectionSettings.

Connect - Remote Document Location Policies

In this example, two Remote DocumentLocation policies are used, which means that remote addresses can only edit documents within the configured locations.

<RemoteDocumentLocationPolicies>
<Policy uriStartsWith="https://example1.com">
<Headers>
<Header name="header1" value="value1"/>
</Headers>
</Policy>
<Policy uriStartsWith="https://example2.com">
<Headers>
<Header name="header2" value="value22"/>
</Headers>
</Policy>
....
</RemoteDocumentLocationPolicies>

Example

In the following example, Forms and Data values are updated via primedocsConnect.

<primedocsConnect>
<DocumentLocation Source="\\MyServer\share\doc\...\documentxyz.docx" />

<Forms HideDialog="true">
<Value Key="FormsKey">New value after update</Value>
</Forms>

<Data>
<Value Key="MyTestValue">New value</Value>
<Object Key="MyTestObject">
<Value Key="Name">New Name</Value>
<Value Key="Address">New Addresse</Value>
</Object>
</Data>

<!-- Save updated Docoument -->
<Commands>
<OnSuccess>
<SaveFile FileName="\\MyServer\share\doc\...\documentxyz-New.docx"
Overwrite="true"
CreateFolder="true">
<Document />
</SaveFile>
</OnSuccess>
</Commands>

</primedocsConnect>
warning

Any excess Forms or Data transmitted will be ignored.

Updated documents can be saved using the available Commands. If the connect call is made without specifying any Commands, the updated document is opened immediately.