This documentation is archived and is not being maintained.

SPFileCollection.Add Method (String, Byte[], Boolean, String, Boolean)

Windows SharePoint Services 3

Creates a file in the collection based on the specified URL, byte array that contains a file, check-in comment, and Boolean value specifying whether to check required fields, overwriting any file of the same name only if overwrite is true.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPFile Add(
	string urlOfFile,
	byte[] file,
	bool overwrite,
	string checkInComment,
	bool checkRequiredFields


Type: System.String
A string that specifies the URL for the file.
Type: []
A byte array containing the file.
Type: System.Boolean
true to overwrite a file of the same name; otherwise, false.
Type: System.String
A string containing a check-in comment to use when creating the file in the collection.
Type: System.Boolean
true to check required fields when saving the file; otherwise, false.

Return Value

Type: Microsoft.SharePoint.SPFile
An SPFile object that represents the file.