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

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.

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

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.

../../../_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 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);