Show / Hide Table of Contents

Class PhysicalDocument

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Inheritance
Object
PhysicalDocument
Implements
IStreamProvider
Namespace: SuperOffice.CRM.Documents
Assembly: SoDataBase.dll
Syntax
public sealed class PhysicalDocument : Object, IStreamProvider
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

Properties

ArchiveProvider

The numeric plugin ID of the plugin responsible for this physical document

Declaration
public int ArchiveProvider { get; }
Property Value
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

DocumentId

ID of document row this physical document is related to

Declaration
public int DocumentId { get; }
Property Value
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

DocumentInfo

Document Info object - created by this class from documentId if needed

Declaration
public IDocumentInfo DocumentInfo { get; }
Property Value
Type Description
IDocumentInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

ExternalReference

External reference for this document

Declaration
public string ExternalReference { get; }
Property Value
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

Length

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public long Length { get; }
Property Value
Type Description
Int64
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

Methods

AssociateRename(String, String)

Invokes document plugins that implements the IAssociateRename interface.

Declaration
public static void AssociateRename(string oldName, string newName)
Parameters
Type Name Description
String oldName
String newName
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

BeginRead()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public void BeginRead()
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

BeginWrite()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public void BeginWrite()
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CheckinDocument(String[], String, String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public ReturnInfo CheckinDocument(string[] allowedReturnTypes, string versionDescription, string[] versionExtraFields)
Parameters
Type Name Description
String[] allowedReturnTypes
String versionDescription
String[] versionExtraFields
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CheckoutDocument(String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public ReturnInfo CheckoutDocument(params string[] allowedReturnTypes)
Parameters
Type Name Description
String[] allowedReturnTypes
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateDefaultDocumentTemplate(Int32, Int32)

Create a blank default document based on the given documentTypeId. Called when creating a new template.

Declaration
public static string CreateDefaultDocumentTemplate(int documentTypeKey, int documentTemplateId)
Parameters
Type Name Description
Int32 documentTypeKey

Id for a document type. Ignored if document plugin does not use document types.

Int32 documentTemplateId

Document template id

Returns
Type Description
String

Extref/Filename for new template. This value is written to the template's Filename property in the database.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateDefaultDocumentTemplateLanguage(IDocumentTemplateInfo, String)

Create a new template language alternative based on the existing template

Declaration
public static void CreateDefaultDocumentTemplateLanguage(IDocumentTemplateInfo docInfo, string languageCode)
Parameters
Type Name Description
IDocumentTemplateInfo docInfo
String languageCode
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateFilenameForNewTemplate(IDocumentTemplateInfo, String)

Calculates a new name for a template based on the properties from an existing template. Should only be used when copying existing templates.

Declaration
public static string CreateFilenameForNewTemplate(IDocumentTemplateInfo sourceTemplateInfo, string newTemplateName)
Parameters
Type Name Description
IDocumentTemplateInfo sourceTemplateInfo
String newTemplateName
Returns
Type Description
String

newer null

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateNewEmpty(IDocumentInfo, ref String, String[], String, String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static string CreateNewEmpty(IDocumentInfo incomingInfo, ref string fileName, string[] extraFields, string versionDecription, string[] versionExtraFields)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String fileName
String[] extraFields
String versionDecription
String[] versionExtraFields
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateNewEmptyByRef(ref IDocumentInfo, ref String, String[], String, String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static string CreateNewEmptyByRef(ref IDocumentInfo incomingInfo, ref string fileName, string[] extraFields, string versionDecription, string[] versionExtraFields)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String fileName
String[] extraFields
String versionDecription
String[] versionExtraFields
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

CreateNewFromTemplate(IDocumentInfo, ref String, String[], String, String[], String)

Create a new document in the document archive without replacing template tags

Declaration
public static string CreateNewFromTemplate(IDocumentInfo incomingInfo, ref string fileName, string[] extraFields, string versionDecription, string[] versionExtraFields, string uiCulture)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String fileName
String[] extraFields
String versionDecription
String[] versionExtraFields
String uiCulture
Returns
Type Description
String

Reference to the newly created document in the document archive.

Remarks

This method will create a new physical document, using the physical template unchanged. No template tag substitution will be attempted, no document conversions, nothing.

The method is generally used for creating mailmerge template documents

CreateNewFromTemplateWithTags(IDocumentInfo, ref String, String[], String, String[], TagContainer, String)

Create a new document in the document archive, replacing template tags

Declaration
public static string CreateNewFromTemplateWithTags(IDocumentInfo incomingInfo, ref string fileName, string[] extraFields, string versionDecription, string[] versionExtraFields, TagContainer templateTags, string uiCulture)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String fileName
String[] extraFields
String versionDecription
String[] versionExtraFields
TagContainer templateTags
String uiCulture

UI Language (en-US or nb-NO) - used to select appropriate doc template

Returns
Type Description
String

Reference to the newly created document in the document archive.

Remarks

This method will create a new physical document, using the physical template and replacing all tags passed in through the TagContainer parameter.

CreateNewFromTemplateWithTagsAsStream(Int32, String, TagContainer)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static Stream CreateNewFromTemplateWithTagsAsStream(int templateId, string uiCulture, TagContainer templateTags)
Parameters
Type Name Description
Int32 templateId
String uiCulture
TagContainer templateTags
Returns
Type Description
Stream
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

DeleteDocument(String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public ReturnInfo DeleteDocument(params string[] allowedReturnTypes)
Parameters
Type Name Description
String[] allowedReturnTypes
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

DeleteDocumentTemplateLanguage(IDocumentTemplateInfo, String)

Deletes the document template language.

Declaration
public static void DeleteDocumentTemplateLanguage(IDocumentTemplateInfo templateInfo, string languageCode)
Parameters
Type Name Description
IDocumentTemplateInfo templateInfo

Information about the template. The fields id and external reference must be filled out

String languageCode

The language code ('en-US, 'nb-NO', etc). Field cannot be empty.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

EndRead()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public void EndRead()
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

EndWrite()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public void EndWrite()
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

ExecuteDocumentCommand(String, String[], String, String[])

Execute a custom command on a specified document and version

Declaration
public ReturnInfo ExecuteDocumentCommand(string versionId, string[] allowedReturnTypes, string command, params string[] additionalData)
Parameters
Type Name Description
String versionId

Version identifier, blank implies 'latest' version

String[] allowedReturnTypes

Array of names of allowed return types; if this array is empty then no limits are placed on return type.

String command

Command name, taken from an earlier call to GetDocumentCommands(String[])

  • or any other command name that is understood by the provider. 'Private' commands that are not declared in GetDocumentCommands but are known to the authors of custom GUI code or OK.
String[] additionalData

Array of strings containing whatever additional data the command may need. This parameter is intended for authors of more complex custom GUI's and works as a tunnel between the ultimate client and the document plugin. Standard GUI made by SuperOffice, such as a context menu connected to a document item in an archive, will not populate this member.
It is strongly suggested that the convention of using name=value for each string array element be followed here.

Returns
Type Description
ReturnInfo

Return value object, specifying failure or success plus any optional, additional processing to be triggered

Remarks

This command is called when the user chooses an action item from a dropdown/context menu. It is also reflected in the DocumentAgent service interface, so that custom GUI’s and external code can directly execute document plugin commands; this is useful if a plugin also has some corresponding custom GUI that needs to execute commands depending on user interaction.

The parameter allowedReturnTypes can be used by clients to hint to the plugin what kind of return value processing is available. For instance, a mobile client might only offer None and Message, and this information can be used by the document plugin to adapt the processing of a command, if it wants to (for instance, use default values instead of triggering some more advanced workflow).

The command is obtained from the GetDocumentCommands(String[]) method.

Exists()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public bool Exists()
Returns
Type Description
Boolean
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetAllDocPlugins()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static Dictionary<int, string> GetAllDocPlugins()
Returns
Type Description
Dictionary<Int32, String>
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetCheckoutState()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public CheckoutInfo GetCheckoutState()
Returns
Type Description
CheckoutInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDatabaseLanguageCode()

Returns the database language for the current SuperOffice installation as stored in the ProductVersion table "SuperOffice" "DatabaseLanguage". "US"

Declaration
public static string GetDatabaseLanguageCode()
Returns
Type Description
String

SuperOffice Language code: "US", "SW", "GE" etc. NULL if nothing is configured.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDatabaseLanguageCulture()

Returns the database language for the current SuperOffice installation as stored in the ProductVersion table "SuperOffice" "DatabaseLanguage". "US"

Declaration
public static CultureInfo GetDatabaseLanguageCulture()
Returns
Type Description
CultureInfo

CultureInfo based on the neutral ISO language: "en", "sv", "de" etc. NULL if nothing is configured.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDefaultDocumentPluginId()

Get the default document plugin id

Declaration
public static int GetDefaultDocumentPluginId()
Returns
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocument(IDocumentInfo)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static PhysicalDocument GetDocument(IDocumentInfo incomingInfo)
Parameters
Type Name Description
IDocumentInfo incomingInfo
Returns
Type Description
PhysicalDocument
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocument(Int32)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static PhysicalDocument GetDocument(int documentId)
Parameters
Type Name Description
Int32 documentId
Returns
Type Description
PhysicalDocument
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentCommands(String[])

Get a list of custom commands, applicable to a specific document. Note that commands related to standard locking and versioning operations have their own API calls and are not 'custom commands' in this sense.

Declaration
public CommandInfo[] GetDocumentCommands(params string[] allowedReturnTypes)
Parameters
Type Name Description
String[] allowedReturnTypes

Array of names of allowed return types; if this array is empty then no limits are placed on return type.

Returns
Type Description
CommandInfo[]

Array of command descriptions. If there are no custom commands available, an empty array should be returned.

Remarks

This API is called before a menu, task button or other GUI item that gives access to document-specific commands is shown. It is used to populate the GUI with available commands for a particular document, the results are not cached by the GUI.

Depending on the return type indicated in the command, the command might be filtered by GUI. More information can be found in the CommandInfo topic.

GetDocumentIdFromPath(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static int GetDocumentIdFromPath(string documentNameAndPath)
Parameters
Type Name Description
String documentNameAndPath
Returns
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentProperties(String[])

Get the values of certain properties, for a given document

Declaration
public Dictionary<string, string> GetDocumentProperties(params string[] requestedProperties)
Parameters
Type Name Description
String[] requestedProperties
Returns
Type Description
Dictionary<String, String>

Dictionary of key=value pairs, where the key is one of the requested property strings, and the value is the value of that property for the given document.

Remarks

Each document can have a number of properties associated with it. A set of standard properties is defined in the Constants.Properties class. Ideally, retrieving properties should be a lightweight operation.

Note that 'properties' are a one-way mechanism where the document plugin provides information about the document or certain aspects of it. This is not the same as document-specific metadata, which is handled by the LoadMetaData() and SaveMetaData(String[]) methods.

GetDocumentTemplateProperties(Int32, String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static Dictionary<string, string> GetDocumentTemplateProperties(int documentTemplateId, params string[] requestedProperties)
Parameters
Type Name Description
Int32 documentTemplateId
String[] requestedProperties
Returns
Type Description
Dictionary<String, String>
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentTemplateUrl(Int32, Boolean, String)

Get a WebDAV-compliant URL referring to the given document template

Declaration
public static string GetDocumentTemplateUrl(int documentTemplateId, bool writableUrl, string languageCode)
Parameters
Type Name Description
Int32 documentTemplateId

The id of the document template

Boolean writableUrl
String languageCode

Language variation on the template. May be ignored by the plugin, or used to keep language specific versions of the template.

Returns
Type Description
String

URL that gives access to the document. If the document plugin does not support URL access, then a blank string should be returned.

Remarks

Document plugins may support document access via WebDAV. This call is used to retrieve a WebDAV url that will give the specified access to the document. This URL will be passed to the ultimate client (most probably a text editor application), and control will not return to NetServer.

The string returned here should be a fully resolved URL that can be given directly to the editor application.

GetDocumentTypesForDocumentTemplates(Int32)

Get a list of supported document template types.

Declaration
public static Dictionary<int, string> GetDocumentTypesForDocumentTemplates(int pluginId)
Parameters
Type Name Description
Int32 pluginId
Returns
Type Description
Dictionary<Int32, String>

An dictionary of key=display-name for supported document types for template. Empty dictionary if no document types supported.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentUrl()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public string GetDocumentUrl()
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentUrl(IDocumentInfo, String, Boolean)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static string GetDocumentUrl(IDocumentInfo incomingInfo, string versionId, bool writeableUrl)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String versionId
Boolean writeableUrl
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetDocumentUrl(String, Boolean)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public string GetDocumentUrl(string versionId, bool writeableUrl)
Parameters
Type Name Description
String versionId
Boolean writeableUrl
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetLength(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public long GetLength(string versionId)
Parameters
Type Name Description
String versionId
Returns
Type Description
Int64
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetPlugin(Int32)

Return the plugin specified by its plugin-id

Declaration
public static IDocumentPlugin2 GetPlugin(int pluginId)
Parameters
Type Name Description
Int32 pluginId
Returns
Type Description
IDocumentPlugin2
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetPluginCapabilities(Int32)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static Dictionary<string, string> GetPluginCapabilities(int pluginId)
Parameters
Type Name Description
Int32 pluginId
Returns
Type Description
Dictionary<String, String>
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetTemplateExtension(Int32)

Get the "extension" for the template, i.e., what the file extension would have been - to help identify the stream content format.

Declaration
public static string GetTemplateExtension(int documentTemplateId)
Parameters
Type Name Description
Int32 documentTemplateId

Document template primary key id

Returns
Type Description
String

String equivalent to a file extension, for instance ".docx"

Remarks

Template documents are generally created in text editors and stored as files of some kind. The file extension indicates the kind of document - doc, docx, xls, txt, and so on. While the template may be stored inside the document repository as any kind of data byte collection, a concept akin to the file extension is still needed to help identify the document format, ahead of actually reading the template content.

GetTemplateId(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static int GetTemplateId(string templateName)
Parameters
Type Name Description
String templateName
Returns
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

GetTemplateLanguages(IDocumentTemplateInfo)

Return the list of language-specific variants of a given document template, excepting the default language (""). The DatabaseLanguage should be used to determine the default language.

Declaration
public static string[] GetTemplateLanguages(IDocumentTemplateInfo templateInfo)
Parameters
Type Name Description
IDocumentTemplateInfo templateInfo

The document template info

Returns
Type Description
String[]

Array of ISO language codes identifying language variants: ["en", "sv", "de"]. Empty array if no variants

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.
Exceptions
Type Condition
SoIllegalOperationException

Throws if templateInfo is null or id 0

GetVersionList()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public VersionInfo[] GetVersionList()
Returns
Type Description
VersionInfo[]
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

IsNameValid(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static bool IsNameValid(string name)
Parameters
Type Name Description
String name
Returns
Type Description
Boolean
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentStream()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public Stream LoadDocumentStream()
Returns
Type Description
Stream
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentStream(IDocumentInfo, String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static Stream LoadDocumentStream(IDocumentInfo incomingInfo, string versionId)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String versionId
Returns
Type Description
Stream
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentStream(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public Stream LoadDocumentStream(string versionId)
Parameters
Type Name Description
String versionId
Returns
Type Description
Stream
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentTemplateStream(Int32, String)

Get data stream for document template

Declaration
public static Stream LoadDocumentTemplateStream(int documentTemplateId, string uiCulture)
Parameters
Type Name Description
Int32 documentTemplateId

Identity of document template

String uiCulture
Returns
Type Description
Stream

Opens stream with data for document template

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentTemplateStream(Int32, String, out String)

Get data stream for document template

Declaration
public static Stream LoadDocumentTemplateStream(int documentTemplateId, string uiCulture, out string templateExtension)
Parameters
Type Name Description
Int32 documentTemplateId

Identity of document template

String uiCulture
String templateExtension
Returns
Type Description
Stream

Opens stream with data for document template

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadDocumentTemplateStream(String, Boolean, String)

Retrieve data stream for a document template based on an identifier(Ex: the filename). All available document plugins are searched. The first available template is returned.

Declaration
public static Stream LoadDocumentTemplateStream(string templateIdentifier, bool allowPersonalTemplate, string uiCulture)
Parameters
Type Name Description
String templateIdentifier

Identifier for a template. Ex: "myTemplate.txt"

Boolean allowPersonalTemplate

Should we search for personal templates before central

String uiCulture
Returns
Type Description
Stream

Data stream for template or null if not found

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

LoadMetaData()

Retrieve metadata owned by the plugin/repository, related to one document (excluding version-dependent metadata)

Declaration
public string[] LoadMetaData()
Returns
Type Description
String[]

Array of name=value strings, each representing one key and one value.

Remarks

A document plugin may consume and provide an arbitrary number of metadata fields. These are placed in a string, string dictionary, representing name/value pairs. This call should not retrieve metadata related to any particular version, only data related to the document as a whole.

The NetServer service call DocumentAgent.GetDocumentEntity will (among other things) result in a call to this API to populate the ExtraFields property of the document entity carrier. Note, however, that the carrier handed over to the client may contain other fields in addition to those supplied by the document plugin, since the extrafields mechanism is generic and there may be other metadata providers along the line.

Attribute names should be prefixed with the name of the document plugin, to maintain global uniqueness.

It is strongly suggested that non-string data be formatted according to the rules followed by the CultureDataFormatter class, to avoid problems when parsing dates and floating-point types between different cultures and platforms.

LoadVersionInfo(String)

Retrieve metadata owned by the plugin/repository, related to one particular version of one document

Declaration
public VersionInfo LoadVersionInfo(string versionId)
Parameters
Type Name Description
String versionId

Version identifier, blank implies 'latest' version

Returns
Type Description
VersionInfo

Fully populated version info structure

Remarks

A document plugin may consume and provide an arbitrary number of metadata fields. These are placed in a string, string dictionary, representing name/value pairs. This call should only retrieve metadata related to a version.

The NetServer service call DocumentAgent.GetDocumentEntity will (among other things) result in a call to this API to populate the VersionInfo property of the document entity carrier.

Attribute names should be prefixed with the name of the document plugin, to maintain global uniqueness.

It is strongly suggested that non-string data be formatted according to the rules followed by the CultureDataFormatter class, to avoid problems when parsing dates and floating-point types between different cultures and platforms.

To efficiently retrieve information about all versions, use the GetVersionList(IDocumentInfo) method, instead of iterating over this method.

Read(Int64, Byte[], Int32, Int32)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public int Read(long filePosition, byte[] buffer, int bufferStartPosition, int length)
Parameters
Type Name Description
Int64 filePosition
Byte[] buffer
Int32 bufferStartPosition
Int32 length
Returns
Type Description
Int32
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

RenameDocument(String)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public string RenameDocument(string suggestedNewName)
Parameters
Type Name Description
String suggestedNewName
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

SaveDocumentFromStream(IDocumentInfo, String[], Stream)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static ReturnInfo SaveDocumentFromStream(IDocumentInfo incomingInfo, string[] allowedReturnTypes, Stream content)
Parameters
Type Name Description
IDocumentInfo incomingInfo
String[] allowedReturnTypes
Stream content
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

SaveDocumentFromStream(String[], Stream)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public ReturnInfo SaveDocumentFromStream(string[] allowedReturnTypes, Stream content)
Parameters
Type Name Description
String[] allowedReturnTypes
Stream content
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

SaveDocumentTemplateStream(Int32, Stream, String, Int32, String)

Create or update the document template contents. Usually used when uploading a file to a new document template.

Declaration
public static TemplateInfo SaveDocumentTemplateStream(int documentTemplateId, Stream content, string uiCulture, int pluginId, string providedFilename = null)
Parameters
Type Name Description
Int32 documentTemplateId

Document template record id the database.

Stream content

Stream containing file content

String uiCulture

Language variation on the template. May be ignored by the plugin, or used to keep language specific versions of the template.

Int32 pluginId

If negative, use the plugin specified in the document template's load-from-plugin-id field

String providedFilename

If provided and non-ewmpty, will be used to override extref value passed along to document plugin. Required to support replacing file-formats for existing templates (among other things)

Returns
Type Description
TemplateInfo

Template information with ExtRef/Filename and MimeType filled in. These values are saved in the DocTmpl record.

Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

SaveMetaData(String[])

Store/update plugin-dependent document metadata in the repository

Declaration
public void SaveMetaData(string[] pluginData)
Parameters
Type Name Description
String[] pluginData

Name=value array containing metadata

Remarks

This call is made when the document metadata should be stored, and is the complement of the LoadMetaData(IDocumentInfo) method. The document plugin should extract whatever elements it recognizes from the pluginData name/value dictionary. Failure to recognize an element should not cause an exception, as there may be other plugins along the line (not document plugins, but service-level field providers) that own the data. Likewise, absence of a value should be taken to imply “no change” to that value - not "delete".

It is strongly suggested that non-string data be formatted according to the rules followed by the CultureDataFormatter class, to avoid problems when parsing dates and floating-point types between different cultures and platforms.

SetDocumentTemplateFromDocumentTemplate(IDocumentTemplateInfo, IDocumentTemplateInfo)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public static TemplateInfo SetDocumentTemplateFromDocumentTemplate(IDocumentTemplateInfo sourceTemplateInfo, IDocumentTemplateInfo destTemplateInfo)
Parameters
Type Name Description
IDocumentTemplateInfo sourceTemplateInfo
IDocumentTemplateInfo destTemplateInfo
Returns
Type Description
TemplateInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

SuggestFilename()

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public string SuggestFilename()
Returns
Type Description
String
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

UndoCheckoutDocument(String[])

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public ReturnInfo UndoCheckoutDocument(params string[] allowedReturnTypes)
Parameters
Type Name Description
String[] allowedReturnTypes
Returns
Type Description
ReturnInfo
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

Write(Int64, Byte[], Int32, Int32)

Facade for the Document Plugin system, and one-stop-shop for physical-document operations

Declaration
public void Write(long filePosition, byte[] buffer, int bufferStartPosition, int length)
Parameters
Type Name Description
Int64 filePosition
Byte[] buffer
Int32 bufferStartPosition
Int32 length
Remarks

An instance of this class represents a physical document in a document archive, and can be used to manipulate (Load, Save) that document and its metadata. Instances are constructed using a static factory function, always based on an already existing information in the database.

Static methods also provide access to document template functions and other non-document specific functions.

Implements

IStreamProvider

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top