Interface IArcherDocument
Represents a single document linked to an Archer content record via a IAttachmentField or IImageField.
Namespace: Estrelica.Archer.Content
Assembly: Estrelica.Interfaces.dll
Syntax
[StayPublic]
[DoNotObfuscateType]
public interface IArcherDocument
Properties
Data
A byte[] array containing the physical content of the document (retrieved on demand via the Archer API)
Declaration
byte[] Data { get; }
Property Value
byte[] |
Exceptions
FileNotFoundException
Occurs if the property is accessed when the physical file no longer exists in the Archer instance repository. |
Filename
The display filename of the document as shown in the Archer view/edit UI.
Declaration
string Filename { get; }
Property Value
string |
Remarks
It is possible for this property to return null if the physical file no longer exists in the Archer instance repository.
Id
Methods
Download(string, bool)
Downloads the attachment or image document and saves it to local storage.
Declaration
FileInfo Download(string saveTo = null, bool overwriteIfFileExists = false)
Parameters
string
saveTo
Specifies an (optional) directory or filename where the Data byte[] array should be saved. If saveTo is a relative path (including null), it will be resolved relative to the current operating directory. If the resulting value represents a directory, the output will be saved there using the filename indicated by the Filename property (i.e., the same filename shown in the Archer UI). Otherwise, if saveTo specifies a filename, the output will be saved in that filename. |
bool
overwriteIfFileExists
If true, the file will be saved to the filename resolved via the saveTo parameter regardless of whether a file by that name already exists (i.e. overwriting any existing content). If false, an InvalidOperationException will be raised in the scenario where saveTo resolves to an existing file. |
Returns
FileInfo
A FileInfo object representing the successfully downloaded file. |
Remarks
If specifying a directory, saveTo must end with a directory separator ('\' in Windows, '/' in Linux) in order to avoid ambiguity. Otherwise saveTo is assumed to refer to a filename.
Examples
saveTo = null => The output file will be [Current Executing Directory]\[Filename]
saveTo = "C:\My Documents\" => The output file will be C:\My Documents\[Filename]
saveTo = "SomeTextFile.txt" => The output file will be [Current Executing Directory]\SomeTextFile.txt
saveTo = "subDirectory\SomeTextFile.txt" => The output file will be [Current Executing Directory]\subDirectory\SomeTextFile.txt
saveTo = "..\subDirectory\" => The output file will be [Current Executing Directory's Parent]\subDirectory\[Filename]
saveTo = "C:\My Documents\SomeTextFile.txt" => The output file will be exactly as specified.
Exceptions
FileNotFoundException
Occurs if the physical file no longer exists in the Archer instance repository. |
InvalidOperationException
Occurs if the output file already exists and overwriteFileIfExists = false. |