SPFileCollection.Add method (String, Stream, Hashtable, Boolean, Boolean)

Creates a file in the collection based on the specified URL, a Stream object that contains a file, and a hash table that contains metadata for the file.

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

Syntax

'Declaration
Public Function Add ( _
    urlOfFile As String, _
    file As Stream, _
    properties As Hashtable, _
    overwrite As Boolean, _
    requireWebFilePermissions As Boolean _
) As SPFile
'Usage
Dim instance As SPFileCollection
Dim urlOfFile As String
Dim file As Stream
Dim properties As Hashtable
Dim overwrite As Boolean
Dim requireWebFilePermissions As Boolean
Dim returnValue As SPFile

returnValue = instance.Add(urlOfFile, _
    file, properties, overwrite, requireWebFilePermissions)
public SPFile Add(
    string urlOfFile,
    Stream file,
    Hashtable properties,
    bool overwrite,
    bool requireWebFilePermissions
)

Parameters

  • urlOfFile
    Type: System.String

    A string that specifies the URL for the file.

  • overwrite
    Type: System.Boolean

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

  • requireWebFilePermissions
    Type: System.Boolean

    true to indicate that adding Web files requires the Add and Customize Web Pages permission; otherwise, false. The default is true.

Return value

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

See also

Reference

SPFileCollection class

SPFileCollection members

Add overload

Microsoft.SharePoint namespace