Partilhar via


SPFileCollection.Add Method (String, SPTemplateFileType)

Creates a file in the collection using the specified URL and template file type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableMethodAttribute(Name := "AddTemplateFile", ReturnObjectIdentity := True,  _
    AddReturnValueToCollection := True)> _
Public Function Add ( _
    urlOfFile As String, _
    templateFileType As SPTemplateFileType _
) As SPFile
'Usage
Dim instance As SPFileCollection
Dim urlOfFile As String
Dim templateFileType As SPTemplateFileType
Dim returnValue As SPFile

returnValue = instance.Add(urlOfFile, _
    templateFileType)
[ClientCallableMethodAttribute(Name = "AddTemplateFile", ReturnObjectIdentity = true, 
    AddReturnValueToCollection = true)]
public SPFile Add(
    string urlOfFile,
    SPTemplateFileType templateFileType
)

Parameters

  • urlOfFile
    Type: System.String

    The site-relative URL of the file.

Return Value

Type: Microsoft.SharePoint.SPFile
The newly added file.

See Also

Reference

SPFileCollection Class

SPFileCollection Members

Add Overload

Microsoft.SharePoint Namespace