Condividi tramite


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)
Available in Sandboxed Solutions: No
Available in SharePoint Online

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)> _
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)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)]
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