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

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

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

DeleteFile() public méthode

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
Résultat void

GetFile() public méthode

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

GetFile() public méthode

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
Résultat string

GetFileStream() public méthode

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

GetFileStream() public méthode

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
Résultat Stream

GetFilenamePart() public méthode

public GetFilenamePart ( string fileName ) : string
fileName string
Résultat string

GetFiles() public méthode

Get the files available in the default container
public GetFiles ( ) : List
Résultat List

GetFiles() public méthode

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

GetFolders() public méthode

Get the folders of the default container
public GetFolders ( ) : List
Résultat List

GetFolders() public méthode

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

SaveFileStream() public méthode

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
Résultat void

SaveFileStream() public méthode

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
Résultat void

SharePointConnector() public méthode

Base constructor
public SharePointConnector ( ) : System
Résultat System

SharePointConnector() public méthode

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)
Résultat System