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 |
---|---|---|
GetRootFolder() |
Returns the Vault root folder. |
|
AddFolder(string folderName) |
Creates the passed folder structure. folderName is a valid vault folder path. |
|
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. |
|
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. |
|
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. |
SearchFileByLocation(string fileLocation) |
This function searches for a specific file in the export package if fileLocation exists. |
|
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);