Table of Contents

Interface IFileCollection

Namespace
PnP.Core.Model.SharePoint
Assembly
PnP.Core.dll

Public interface to define a collection of File objects

public interface IFileCollection : IQueryable<IFile>, IQueryable, IAsyncEnumerable<IFile>, IDataModelCollection<IFile>, IEnumerable<IFile>, IEnumerable, IDataModelParent, IDataModelWithContext, IRequestableCollection, IDataModelCollectionLoad<IFile>, IDataModelCollectionDeleteByGuidId, ISupportModules<IFileCollection>
Inherited Members
Extension Methods

Methods

Add(string, Stream, bool)

Add a file to the file collection using batching (sync)

IFile Add(string name, Stream content, bool overwrite = false)

Parameters

name string

The name of the file.

content Stream

The content of the file.

overwrite bool

Indicates whether the file should be overwritten if already existing.

Returns

IFile

The added file object.

AddAsync(string, Stream, bool)

Add a file to the file collection using batching (async)

Task<IFile> AddAsync(string name, Stream content, bool overwrite = false)

Parameters

name string

The name of the file.

content Stream

The content of the file.

overwrite bool

Indicates whether the file should be overwritten if already existing.

Returns

Task<IFile>

The added file object.

AddTemplateFile(string, TemplateFileType)

Adds a file based upon an out of the box template

IFile AddTemplateFile(string serverRelativePageName, TemplateFileType templateFileType)

Parameters

serverRelativePageName string

Server relative url of the page to add

templateFileType TemplateFileType

Type of template file to add

Returns

IFile

The added IFile

AddTemplateFileAsync(string, TemplateFileType)

Adds a file based upon an out of the box template

Task<IFile> AddTemplateFileAsync(string serverRelativePageName, TemplateFileType templateFileType)

Parameters

serverRelativePageName string

Server relative url of the page to add

templateFileType TemplateFileType

Type of template file to add

Returns

Task<IFile>

The added IFile