FileCollection.Add Method
Adds a file to the collection based on provided file creation information.
Namespace: Microsoft.SharePoint.Client
Assemblies: Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll); Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
<RemoteAttribute> _
Public Function Add ( _
parameters As FileCreationInformation _
) As File
'Usage
Dim instance As FileCollection
Dim parameters As FileCreationInformation
Dim returnValue As File
returnValue = instance.Add(parameters)
[RemoteAttribute]
public File Add(
FileCreationInformation parameters
)
Parameters
parameters
Type: Microsoft.SharePoint.Client.FileCreationInformationFile creation information
It must not be null.
Return Value
Type: Microsoft.SharePoint.Client.File
Returns File.
Exceptions
Exception | Condition |
---|---|
[Microsoft.SharePoint.SPDuplicateValuesFoundException] | The list item could not be updated because duplicate values were found for one or more field(s) in the list. Error code: -2130575169. |
[Microsoft.SharePoint.SPException] | Virus checking indicates the file is infected with a virus or the file is too large. Error code: -2146232832. |
[Microsoft.SharePoint.SPFileCheckOutException] | The file in the collection is not checked out. Error code: -2147024738. |
[Microsoft.SharePoint.SPFileCheckOutException] | The file in the collection is already checked out. Error code: -2130575306. |
[Microsoft.SharePoint.SPFileLockException] | The file in the collection is not locked. Error code: -2147024729. |
[Microsoft.SharePoint.SPFileLockException] | The file in the collection has bad lock argument. Error code: -2147023436. |
[Microsoft.SharePoint.SPFileLockException] | There is a shared lock on the file in the collection. Error code: -2147018894. |
[Microsoft.SharePoint.SPFileLockException] | There is an exclusive lock on the file in the collection. Error code: -2147018887. |
[Microsoft.SharePoint.SPInvalidLookupValuesException] | The list item could not be updated because invalid lookup values were found for one or more fields in the list. Error code: -2130575159. |
[System.ArgumentException] | URL of the file creation information must not be null and URL of the file creation information must not be invalid. Error code: -2147024809. |
[System.ArgumentNullException] | Content of the file creation information must not be null. Error code: -2147467261. |
[System.ArgumentOutOfRangeException] | There is a mismatch between the size of the document stream written and the size of the input document stream. Error code: - 2146233086. |