Add Method (String, Stream, Boolean, String, Boolean)
This documentation is archived and is not being maintained.

SPFileCollection.Add Method (String, Stream, Boolean, String, Boolean)

Windows SharePoint Services 3

Creates a file in the collection based on the specified URL, Stream object 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,
	Stream stream,
	bool overwrite,
	string checkInComment,
	bool checkRequiredFields
)

Parameters

urlOfFile
Type: System.String
A string that specifies the URL for the file.
stream
Type: System.IO.Stream
A System.IO.Stream object that contains the file.
overwrite
Type: System.Boolean
true to overwrite a file of the same name; otherwise, false.
checkInComment
Type: System.String
A string containing a check-in comment to use when creating the file in the collection.
checkRequiredFields
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.
Show:
© 2016 Microsoft