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.StringA string that specifies the URL for the file.
file
Type: System.IO.StreamA Stream object that contains the file.
properties
Type: System.Collections.HashtableA Hashtable object containing metadata for the file.
overwrite
Type: System.Booleantrue to overwrite a file of the same name; otherwise, false.
requireWebFilePermissions
Type: System.Booleantrue 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.