C# Class OfficeDevPnP.Core.Framework.Provisioning.Connectors.SharePointConnector

Connector for files in SharePoint
Inheritance: OfficeDevPnP.Core.Framework.Provisioning.Connectors.FileConnectorBase
Mostra file Open project: OfficeDev/PnP-Sites-Core Class Usage Examples

Public Methods

Method Description
DeleteFile ( string fileName ) : void

Deletes a file from the default container

DeleteFile ( string fileName, string container ) : void

Deletes a file from the specified container

GetFile ( string fileName ) : string

Gets a file as string from the default container

GetFile ( string fileName, string container ) : string

Gets a file as string from the specified container

GetFileStream ( string fileName ) : Stream

Gets a file as stream from the default container

GetFileStream ( string fileName, string container ) : Stream

Gets a file as stream from the specified container

GetFilenamePart ( string fileName ) : string
GetFiles ( ) : List

Get the files available in the default container

GetFiles ( string container ) : List

Get the files available in the specified container

GetFolders ( ) : List

Get the folders of the default container

GetFolders ( string container ) : List

Get the folders of a specified container

SaveFileStream ( string fileName, Stream stream ) : void

Saves a stream to the default container with the given name. If the file exists it will be overwritten

SaveFileStream ( string fileName, string container, Stream stream ) : void

Saves a stream to the specified container with the given name. If the file exists it will be overwritten

SharePointConnector ( ) : System

Base constructor

SharePointConnector ( ClientRuntimeContext clientContext, string connectionString, string container ) : System

SharePointConnector constructor. Allows to directly set root folder and sub folder

Private Methods

Method Description
GetClientContext ( ) : ClientRuntimeContext
GetContainer ( ) : string
GetDocumentLibrary ( string container ) : string
GetFileFromStorage ( string fileName, string container ) : MemoryStream
GetFileServerRelativeUrl ( ClientContext cc, string fileName, string container ) : string
GetUrlFolders ( string container ) : string

Method Details

DeleteFile() public method

Deletes a file from the default container
public DeleteFile ( string fileName ) : void
fileName string Name of the file to delete
return void

DeleteFile() public method

Deletes a file from the specified container
public DeleteFile ( string fileName, string container ) : void
fileName string Name of the file to delete
container string Name of the container to delete the file from
return void

GetFile() public method

Gets a file as string from the default container
public GetFile ( string fileName ) : string
fileName string Name of the file to get
return string

GetFile() public method

Gets a file as string from the specified container
public GetFile ( string fileName, string container ) : string
fileName string Name of the file to get
container string Name of the container to get the file from
return string

GetFileStream() public method

Gets a file as stream from the default container
public GetFileStream ( string fileName ) : Stream
fileName string Name of the file to get
return Stream

GetFileStream() public method

Gets a file as stream from the specified container
public GetFileStream ( string fileName, string container ) : Stream
fileName string Name of the file to get
container string Name of the container to get the file from
return Stream

GetFilenamePart() public method

public GetFilenamePart ( string fileName ) : string
fileName string
return string

GetFiles() public method

Get the files available in the default container
public GetFiles ( ) : List
return List

GetFiles() public method

Get the files available in the specified container
public GetFiles ( string container ) : List
container string Name of the container to get the files from
return List

GetFolders() public method

Get the folders of the default container
public GetFolders ( ) : List
return List

GetFolders() public method

Get the folders of a specified container
public GetFolders ( string container ) : List
container string Name of the container to get the folders from
return List

SaveFileStream() public method

Saves a stream to the default container with the given name. If the file exists it will be overwritten
public SaveFileStream ( string fileName, Stream stream ) : void
fileName string Name of the file to save
stream Stream Stream containing the file contents
return void

SaveFileStream() public method

Saves a stream to the specified container with the given name. If the file exists it will be overwritten
public SaveFileStream ( string fileName, string container, Stream stream ) : void
fileName string Name of the file to save
container string Name of the container to save the file to
stream Stream Stream containing the file contents
return void

SharePointConnector() public method

Base constructor
public SharePointConnector ( ) : System
return System

SharePointConnector() public method

SharePointConnector constructor. Allows to directly set root folder and sub folder
public SharePointConnector ( ClientRuntimeContext clientContext, string connectionString, string container ) : System
clientContext ClientRuntimeContext
connectionString string Site collection URL (e.g. https://yourtenant.sharepoint.com/sites/dev)
container string Library + folder that holds the files (mydocs/myfolder)
return System