Skip to main content
Version: 1.1.0

ICASharePointDocumentService

@spartanfx/react v1.1.0


@spartanfx/react / codeapps / ICASharePointDocumentService

Interface: ICASharePointDocumentService

Semantic interface the DocumentManager hook depends on. Consumers write a small adapter that bridges the methods of their generated SharePoint connector service (CreateFile, GetFileContent, DeleteFile, CreateNewFolder, MoveFile, CopyFile, ListFolder, ...) to this interface.

Library has no direct dependency on the connector method names so connector schema updates do not require library changes.

Methods

copyFile()

copyFile(sourcePath, destinationPath): Promise<ICAResult<ICASharePointRawItem>>;

Copy a file.

Parameters

sourcePath

string

destinationPath

string

Returns

Promise<ICAResult<ICASharePointRawItem>>


createFolder()

createFolder(parentPath, folderName): Promise<ICAResult<ICASharePointRawItem>>;

Create a folder under a parent path.

Parameters

parentPath

string

folderName

string

Returns

Promise<ICAResult<ICASharePointRawItem>>


deleteItem()

deleteItem(itemPath, isFolder): Promise<ICAResult<void>>;

Delete a file or folder by server-relative path.

Parameters

itemPath

string

isFolder

boolean

Returns

Promise<ICAResult<void>>


downloadFile()

downloadFile(itemPath): Promise<ICAResult<Blob>>;

Download a file's binary content.

Parameters

itemPath

string

Returns

Promise<ICAResult<Blob>>


getAbsoluteUrl()?

optional getAbsoluteUrl(serverRelativePath): Promise<ICAResult<string>>;

Resolve an absolute web URL for a server-relative path.

Parameters

serverRelativePath

string

Returns

Promise<ICAResult<string>>


listFolder()

listFolder(folderPath): Promise<ICAResult<ICASharePointListResult>>;

List children of a folder by server-relative path.

Parameters

folderPath

string

Returns

Promise<ICAResult<ICASharePointListResult>>


moveItem()

moveItem(
sourcePath,
destinationPath,
isFolder): Promise<ICAResult<ICASharePointRawItem>>;

Move a file or folder.

Parameters

sourcePath

string

destinationPath

string

isFolder

boolean

Returns

Promise<ICAResult<ICASharePointRawItem>>


renameItem()?

optional renameItem(
itemPath,
newName,
isFolder): Promise<ICAResult<ICASharePointRawItem>>;

Rename a file or folder. (Default implementation falls back to moveItem.)

Parameters

itemPath

string

newName

string

isFolder

boolean

Returns

Promise<ICAResult<ICASharePointRawItem>>


uploadFile()

uploadFile(
folderPath,
fileName,
content,
onProgress?): Promise<ICAResult<ICASharePointRawItem>>;

Upload a file into a folder. Optional progress callback.

Parameters

folderPath

string

fileName

string

content

Blob

onProgress?

(progress) => void

Returns

Promise<ICAResult<ICASharePointRawItem>>