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. |
|
AddFile(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. |
|
SearchFilesByName(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 function AddFile also handles the situation when a file or folder already exists. If you add a library file to a folder that is not marked as „Library“, the folder will not be marked as a library. Use SetLibrary(true) if you want to mark the folder anyway 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);