Click or drag to resize
ISharePointFileServiceUploadFile Method
Uploads the file's content specified as a stream to the serverRelativeUrl location.

Namespace: CMS.SharePoint
Assembly: CMS.SharePoint (in CMS.SharePoint.dll) Version: 13.0.131
Syntax
C#
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
ExceptionCondition
SharePointFileAlreadyExistsExceptionThrown when trying to upload to serverRelativeUrl location which already exists and overwriteExisting is set to false.
InvalidOperationExceptionThrown when trying to upload to the library sharePointLibraryTitle which does not exist.
ArgumentExceptionThrown when trying to upload to serverRelativeUrl location which already exists, overwriteExisting is set to true, but the location can not be overwritten.
ArgumentNullExceptionThrown when serverRelativeUrl is null.
ArgumentOutOfRangeExceptionThrown when serverRelativeUrl is in invalid format.
SharePointConnectionNotSupportedExceptionThrown when given connectionData contains unsupported authentication mode or invalid URL.
SharePointServerExceptionThrown whenever server error occurs.
WebExceptionThrown when error related to network or protocol occurs.
ExceptionThrown in case of unexpected error condition.
See Also