IFileService Interface

Contains functionality to add, search and manipulate files and folders in your package.

Namespace: bcpDevKit
Assembly: bcpDevKit.dll

Syntax

public interface IFileService

Methods

Type

Name

Description

../../../_images/method.ico RootObject

GetRootFolder()

Returns the Vault root folder.

../../../_images/method.ico FolderObject

AddFolder(string folderName)

Creates the passed folder structure. folderName is a valid vault folder path.

../../../_images/method.ico FileObject

AddFileWithIteration(string targetFileName, string sourceFileName, bool isLibrary=false)

Creates the passed folder structure and file. targetFileName is the path to the file destination, sourceFileName is the path to the sourceFile, if isLibrary is true, the file gets handled as content center file.

../../../_images/method.ico FileObject

AddFileWithIterationRef(string targetFileName, long checksum, DateTime createDate, bool isLibrary=false)

Creates folder structure and a file with an IterationRef referencing a file that already exists in the Vault.
targetFileName is the path to the file destination, checksum is the checksum of the file in Vault, createDate is the creation date of the file in Vault (requires milliseconds), if isLibrary is true, the file gets handled as content center file.

../../../_images/method.ico IEnumerable<FileObject>

SearchFilesByName(FolderObject rootFolderOfSearch, string fileName, bool searchRecursive=true)

Looks for files by their name in a specific folder and its subdirectories. rootFolderOfSearch is the first folder where the search is performed, fileName is the name the function searches for.

../../../_images/method.ico FileObject

SearchFileByLocation(string fileLocation)

This function searches for a specific file in the export package if fileLocation exists.

../../../_images/method.ico FolderObject

SearchFolderByPath(string folderPath)

Searches the export package for a specific folder if folderPath exists.

Remarks

The functions AddFileWithIteration and AddFileWithIterationRef can handle situations where a file or folder already exists. If a library file is added to a folder that is not marked as „Library“, the folder will not be marked as a library. SetLibrary(true) can by used to mark the folder as a library. Only if the folder has to be created automatically or is already a library, the file will be added as a content center.

Examples

Search Files by Name

var searchRecursive = true;
var foundFiles = bcpService.FileService.SearchFilesByName(GetMyFolder(), "Pad Lock.iam", searchRecursive);