Class SoArc2Helper
Helper class containing utility methods (e.g to retrieve data from ForeignKey Table)
Namespace: SuperOffice.CRM.Documents
Assembly: SoDataBase.dll
Syntax
public static class SoArc2Helper : Object
Methods
CreateReturnInfo(Boolean, String, String, ReturnType, String, String)
Create a ReturnInfo object
Declaration
public static ReturnInfo CreateReturnInfo(bool success, string externalReference, string versionId, ReturnType type, string value, string additionalInfo)
Parameters
Type | Name | Description |
---|---|---|
Boolean | success | success/failure status |
String | externalReference | External Reference |
String | versionId | Version Id |
ReturnType | type | Return type |
String | value | Return value |
String | additionalInfo | Additional Info |
Returns
Type | Description |
---|---|
ReturnInfo | ReturnInfo |
EnsureDirectoryExists(DirectoryInfo)
Verify that a directory exists, and if not, create all missing folders
Declaration
public static void EnsureDirectoryExists(DirectoryInfo dirInfo)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | dirInfo |
GetArchivePath()
Path to the main document archive.
Declaration
public static string GetArchivePath()
Returns
Type | Description |
---|---|
String | "\server\so_arc" |
GetArchivePaths()
Path to the document archives, including the main document archive.
Declaration
public static string[] GetArchivePaths()
Returns
Type | Description |
---|---|
String[] | ("\server\so_arc", "\other\so_arc2") |
GetAssociateName(Int32)
Get the associate name for a given associate id
Declaration
public static string GetAssociateName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate Id |
Returns
Type | Description |
---|---|
String | Associate Name |
GetCurrentVersionFolderPath(IDocumentInfo, String)
This is the folder path where the latest document is in
Declaration
public static string GetCurrentVersionFolderPath(IDocumentInfo documentInfo, string filename = null)
Parameters
Type | Name | Description |
---|---|---|
IDocumentInfo | documentInfo | document id/name/heading |
String | filename | Optional filename override for generated filenames - used if the documentInfo.Name is blank. |
Returns
Type | Description |
---|---|
String | \server\so_arc\user\1999.1 |
GetCurrentVersionFolderPath(DocumentRow)
This is the folder path where the latest document is located.
Declaration
public static string GetCurrentVersionFolderPath(DocumentRow documentRow)
Parameters
Type | Name | Description |
---|---|---|
DocumentRow | documentRow | document id, name, heading etc |
Returns
Type | Description |
---|---|
String | \server\so_arc\user\1999.2 |
GetFullArchivePath(IDocumentInfo, String)
This method will return the physical location of the given document based on the provided IDocumentInfo.
Declaration
public static string GetFullArchivePath(IDocumentInfo documentInfo, string filename = null)
Parameters
Type | Name | Description |
---|---|---|
IDocumentInfo | documentInfo | DocumentInfo object containing the document information |
String | filename | Optional filename override for generated filename - used if the documentInfo.Name is blank. |
Returns
Type | Description |
---|---|
String | Full Archive Path |
GetFullArchivePath(DocumentRow)
This method will return the physical location of the given document based on the provided IDocumentInfo.
Declaration
public static string GetFullArchivePath(DocumentRow documentRow)
Parameters
Type | Name | Description |
---|---|---|
DocumentRow | documentRow | DocumentRow object containing the document information |
Returns
Type | Description |
---|---|
String | Full Archive Path |
GetUniqueFileName(String)
This will get a unique file name in the given path.
Declaration
public static string GetUniqueFileName(string completeFilePath)
Parameters
Type | Name | Description |
---|---|---|
String | completeFilePath | Complete file path including the file name |
Returns
Type | Description |
---|---|
String | A string to a unique filename with no path which is guaranteed not to exist in the path provided. |
Remarks
this will ensure to return an unique file name for the given location If it finds a file(s) with the same name it will create a filename with a suffix with a proper index. e.g It'll create Test[2].docx (if it finds the Test.docx & Test[1].docx in the requested location
GetUniqueFilePath(String)
This will get a unique file name and path in the given path.
Declaration
public static string GetUniqueFilePath(string completeFilePath)
Parameters
Type | Name | Description |
---|---|---|
String | completeFilePath | Complete file path including the file name |
Returns
Type | Description |
---|---|
String | A string to a complete filename and path which is guaranteed not to exist. |
Remarks
this will ensure to return an unique file name for the given location If it finds a file(s) with the same name it will create a filename with a suffix with a proper randomized string. e.g It'll create Test[xyz].docx (if it finds the Test.docx & Test[xyz].docx in the requested location
MakeLegalFileName(String)
Sanitize a file name (no path); this removes backslash and other dangerous characters
Declaration
public static string MakeLegalFileName(string fileNameWithoutPath)
Parameters
Type | Name | Description |
---|---|---|
String | fileNameWithoutPath |
Returns
Type | Description |
---|---|
String |
MakeLegalFileNameAndDirectory(String, Boolean)
Given a suggested file name (typically derived from a document.header), and make it legal; create directories on the way
Declaration
public static string MakeLegalFileNameAndDirectory(string suggestedFullPathWithExtension, bool skipExistenceCheck = false)
Parameters
Type | Name | Description |
---|---|---|
String | suggestedFullPathWithExtension | |
Boolean | skipExistenceCheck |
Returns
Type | Description |
---|---|
String |
Remarks
This is in fact rather complicated. There can be a volume designator, such as q: or \?\q: at the beginning of a path - colon is legal there, as is the question mark, but only in these very special places. Elsewhere the illegal-characters set applies. And we also want to guard against upwards navigation using ..\ syntax.
MakeLegalPathName(String)
Sanitize a file name (no path); this removes backslash and other dangerous characters
Declaration
public static string MakeLegalPathName(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path |
Returns
Type | Description |
---|---|
String |