Class SharePointConnector
Connector for files in SharePoint
Inheritance
System.Object
SharePointConnector
Assembly: PnP.Framework.dll
Syntax
public class SharePointConnector : FileConnectorBase
Constructors
Declaration
public SharePointConnector()
SharePointConnector constructor. Allows to directly set root folder and sub folder
Declaration
public SharePointConnector(ClientRuntimeContext clientContext, string connectionString, string container)
Parameters
ClientRuntimeContext
clientContext
Client context for SharePoint connection
|
System.String
connectionString
Site collection URL (e.g. https://yourtenant.sharepoint.com/sites/dev)
|
System.String
container
Library + folder that holds the files (mydocs/myfolder)
|
Fields
Declaration
public const string CLIENTCONTEXT = null
Field Value
Methods
Deletes a file from the default container
Declaration
public override void DeleteFile(string fileName)
Parameters
System.String
fileName
Name of the file to delete
|
Overrides
Deletes a file from the specified container
Declaration
public override void DeleteFile(string fileName, string container)
Parameters
System.String
fileName
Name of the file to delete
|
System.String
container
Name of the container to delete the file from
|
Overrides
Gets a file as string from the default container
Declaration
public override string GetFile(string fileName)
Parameters
System.String
fileName
Name of the file to get
|
Returns
System.String
String containing the file contents
|
Overrides
Gets a file as string from the specified container
Declaration
public override string GetFile(string fileName, string container)
Parameters
System.String
fileName
Name of the file to get
|
System.String
container
Name of the container to get the file from
|
Returns
System.String
String containing the file contents
|
Overrides
Returns a filename without a path
Declaration
public override string GetFilenamePart(string fileName)
Parameters
System.String
fileName
Name of the file
|
Returns
System.String
Returns a filename without a path
|
Overrides
Get the files available in the default container
Declaration
public override List<string> GetFiles()
Returns
List<System.String>
List of files
|
Overrides
Get the files available in the specified container
Declaration
public override List<string> GetFiles(string container)
Parameters
System.String
container
Name of the container to get the files from
|
Returns
List<System.String>
List of files
|
Overrides
Gets a file as stream from the default container
Declaration
public override Stream GetFileStream(string fileName)
Parameters
System.String
fileName
Name of the file to get
|
Returns
Stream
String containing the file contents
|
Overrides
Gets a file as stream from the specified container
Declaration
public override Stream GetFileStream(string fileName, string container)
Parameters
System.String
fileName
Name of the file to get
|
System.String
container
Name of the container to get the file from
|
Returns
Stream
String containing the file contents
|
Overrides
Get the folders of the default container
Declaration
public override List<string> GetFolders()
Returns
List<System.String>
List of folders
|
Overrides
Get the folders of a specified container
Declaration
public override List<string> GetFolders(string container)
Parameters
System.String
container
Name of the container to get the folders from
|
Returns
List<System.String>
List of folders
|
Overrides
Saves a stream to the default container with the given name. If the file exists it will be overwritten
Declaration
public override void SaveFileStream(string fileName, Stream stream)
Parameters
System.String
fileName
Name of the file to save
|
Stream
stream
Stream containing the file contents
|
Overrides
Saves a stream to the specified container with the given name. If the file exists it will be overwritten
Declaration
public override void SaveFileStream(string fileName, string container, Stream stream)
Parameters
System.String
fileName
Name of the file to save
|
System.String
container
Name of the container to save the file to
|
Stream
stream
Stream containing the file contents
|
Overrides
Extension Methods