ISharePointFileServiceUploadFile Method |
Uploads the file's content specified as a stream to the serverRelativeUrl location.
Namespace: CMS.SharePointAssembly: CMS.SharePoint (in CMS.SharePoint.dll) Version: 13.0.131
Syntax void UploadFile(
string sharePointLibraryTitle,
string serverRelativeUrl,
Stream stream,
bool overwriteExisting
)
Parameters
- sharePointLibraryTitle
- Type: SystemString
Title of the library on SharePoint. - serverRelativeUrl
- Type: SystemString
Server relative URL of the file. - stream
- Type: System.IOStream
Stream with the file content. - overwriteExisting
- Type: SystemBoolean
If true, an existing file will be overwritten when it already exists.
Exceptions Exception | Condition |
---|
SharePointFileAlreadyExistsException | Thrown when trying to upload to serverRelativeUrl location which already exists and overwriteExisting is set to false. |
InvalidOperationException | Thrown when trying to upload to the library sharePointLibraryTitle which does not exist. |
ArgumentException | Thrown when trying to upload to serverRelativeUrl location which already exists, overwriteExisting is set to true, but the location can not be overwritten. |
ArgumentNullException | Thrown when serverRelativeUrl is null. |
ArgumentOutOfRangeException | Thrown when serverRelativeUrl is in invalid format. |
SharePointConnectionNotSupportedException | Thrown when given connectionData contains unsupported authentication mode or invalid URL. |
SharePointServerException | Thrown whenever server error occurs. |
WebException | Thrown when error related to network or protocol occurs. |
Exception | Thrown in case of unexpected error condition. |
See Also