Share via


Add(String, Byte[], Boolean) Method

The Add method of the SPFileCollection class creates a file in the collection based on the specified URL and on a byte array that contains a file, overwriting any file of the same name only if overwrite is true.

Parameters

strUrl   A string that specifies the URL for the file.

file   A byte array containing the file.

overwrite  true to overwrite a file of the same name; otherwise, false.

Return Value

A Microsoft.SharePoint.SPFile object that represents the file.

Example

The following code example iterates through the collection of files in a document library of a site and, if the check-in comment for a file is "Finished", copies the file to a specified folder.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security