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.StringThe site-relative URL of the file.
templateFileType
Type: Microsoft.SharePoint.SPTemplateFileTypeAn enumeration value that specifies whether the page is a standard SharePoint page or a wiki page.
Return Value
Type: Microsoft.SharePoint.SPFile
The newly added file.