Zetadocs Interface

<< Click to Display Table of Contents >>

Navigation:  Zetadocs SDK Guide > Zetadocs SDK API >

Zetadocs Interface

Zetadocs Interface Codeunit

 

The Zetadocs Interface Codeunit exposes procedures that allow you to use the Zetadocs functionality.

 

Method name

Description

ArchiveViaZetadocs(FileName, FileData, RecordId)

Archive the provided data against the record.

TryArchiveViaZetadocs(FileName, FileData, RecordId): Boolean

Tries to archive the provided data against the record. Returns true if the operation succeeds.

SearchViaZetadocs(RecordId, List of [Dictionary of [Text, Text]])

Search for related Documents.

TrySearchViaZetadocs(RecordId, List of [Dictionary of [Text, Text]]): Boolean

Tries to search for documents related to the RecordId provided. Returns true if the operation succeeds.

 

ArchiveViaZetadocs

This methods gives the ability to archive a file programmatically using the Zetadocs functionality similarly as if using Drag and Drop. If the archive operation fails, Archive will raise a user-facing error. This is suitable for scenarios where immediate feedback is required and the failure should be visible to the end user.

 

Syntax

Archive(FileName: Text; FileDataAsBase64String: Text; RecordId: RecordId)

 

Parameters

FileName

Type: Text

The name of the file to be archived, including the extension. The same extensions restrictions as when using the Zetadocs Factbox will be in place.

 

FileDataAsBase64String

Type: Text

The content of the file to be archived. The data must be formatted as a Base64 string. The same file size restriction as when using the Zetadocs Factbox will be in place.

 

RecordId

Type: RecordId

The identifier of the Business Central record to be archived against.

 

TryArchiveViaZetadocs

This methods gives the ability to archive a file programmatically using the Zetadocs functionality similarly as if using Drag and Drop. Unlike ArchiveViaZetadocs, TryArchiveViaZetadocs does not raise a user-facing error if the operation fails. Instead, it returns a result or error object, allowing developers to handle failures programmatically. This is ideal for background processes or situations where custom error handling is needed.

 

Syntax

Archive(FileName: Text; FileDataAsBase64String: Text; RecordId: RecordId) WasArchiveSucess: Boolean

 

Parameters

FileName

Type: Text

The name of the file to be archived, including the extension. The same extensions restrictions as when using the Zetadocs Factbox will be in place.

 

FileDataAsBase64String

Type: Text

The content of the file to be archived. The data must be formatted as a Base64 string. The same file size restriction as when using the Zetadocs Factbox will be in place.

 

RecordId

Type: RecordId

The identifier of the Business Central record to be archived against.

 

Return Value

WasArchiveSucess

Type: Boolean

Indicates if the archiving to SharePoint was successful.

 

SearchViaZetadocs

Search for documents related to the RecordId provided.

 

Syntax

Search(recordIds: List of [RecordId]; var searchResultDictionary: List of [Dictionary of [Text, Text]])

Search(RecordId: RecordId; var searchResultDictionary: List of [Dictionary of [Text, Text]])

 

Parameters

recordIds

Type: List of [RecordId]

This list of Business Central records will be used to search for linked documents in SharePoint.

 

RecordId

Type: RecordId

This Business Central record will be used to search for linked documents in SharePoint.

 

searchResultDictionary

Type: List of [Dictionary of [Text, Text]]

You should iterate over the list to retrieve a further dictionary, containing the metadata for the related file. The currently available metadata is as follows:

Modified, FileName, Url, DocumentReference, DocumentType.

 

Each entry in the dictionary represents a property of the matching file or document.

 

Returned Dictionary Structure

The dictionary contains the following keys:

Modified

The date and time the file was last modified.

FileName

The name of the file including the extension

Url

The direct URL to access or download the file.

DocumentReference

The unique ID for the document.

DocumentLink

The link used to match to a record in Business Central.

 

TrySearchViaZetadocs

This method gives you the ability to retrieve the list of documents from SharePoint that are associated with the Business Central records. For performance reasons it is best to build up a list of RecordIds then perform the search once.

 

Syntax

TrySearch(recordIds: List of [RecordId]; var searchResultDictionary: List of [Dictionary of [Text, Text]]) WasSearchSucess: Boolean

TrySearch(RecordId: RecordId; var searchResultDictionary: List of [Dictionary of [Text, Text]]) WasSearchSucess: Boolean

 

Parameters

recordIds

Type: List of [RecordId]

This list of Business Central records will be used to search for linked documents in SharePoint.

 

RecordId

Type: RecordId

This Business Central record will be used to search for linked documents in SharePoint.

 

searchResultDictionary

Type: List of [Dictionary of [Text, Text]]

You should iterate over the list to retrieve a further dictionary, containing the metadata for the related file. The currently available metadata is as follows:

Modified, FileName, Url, DocumentReference, DocumentType.

 

Return Value

WasSearchSucess

Type: Boolean

Indicates if the search to SharePoint was successful.