Transfer User Content
/documents/api/1.2/users/{userID}/transferContent
Transfer either all user (userID
) content or a specific folder to another user (targetUserID
). During transfer, a new folder is created at the destination user's home folder (named 'Documents from {sourceUsername}') and all content is moved in there. After the transfer is finished, this new folder will be automatically shared with the source user.
To transfer user content, you must log in as an administrator.
Request
- application/json
- application/xml
-
userID: string
Specify the source
userID
from where all content will be transferred. User GUID or login can be used.
object
-
idList(optional):
string
(Optional) If not passed, then
all users content is transfered to the specifiedtargetUserID
. If a globally unique identifier (GUID) for a folder is passed, then the folder is transfered to the specifiedtargetUserID
. Currently only one folder can be transfered per call. -
targetUserID(optional):
string
(Required) Specify the destination
userID
where all content will be transferred. User GUID or login can be used.
{
"targetUserID":"UserA",
"idList":"FA8E5194EE2D2EB532237BA398B217802FF797DD1F8E"
}
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
object
-
errorCode(optional):
string
An error code of zero (0) indicates no errors.
-
sourceUser(optional):
object User
User information
-
targetUser(optional):
object User
User information
object
-
displayName(optional):
string
The display name for the user.
-
id(optional):
string
Globally unique identifier (GUID) for the user.
-
loginName(optional):
string
The login name for the user.
-
type(optional):
string
Item type
user
.
{
"errorCode":"0",
"sourceUser":{
"id":"U0EAA20910FAF3052ACB79E4T00000000001",
"displayName":"User BB",
"loginName":"userBBLoginName",
"type":"user"
},
"targetUser":{
"id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
"displayName":"User AA",
"loginName":"userAALoginName",
"type":"user"
}
}
400 Response
Required field is not provided.
403 Response
Unauthorized access.
404 Response
Source and/or destination user is not found.
Examples
The following example transfers all UserB
content to UserA
. All content will be moved into a new folder called Documents From UserB
, which will be created in the UserA
home folder. This new folder will be shared with UserB
automatically.
POST .../users/UserB/transferContent
Request Header
None.
Request Body
{ "targetUserID": "UserA" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "errorCode":"0", "sourceUser":{ "displayName":"UserB", "id":"U0EAA20910FAF3052ACB79E4T00000000001", "loginName":"userBLoginName", "type":"user" }, "targetUser":{ "displayName":"UserA", "id":"U7ECC74059E0FEDFEC66BF5AT00000000001", "loginName":"userALoginName", "type":"user" } }
Example 2
The following example requests the transfer of UserB
content without a destination user.
POST .../users/UserB/transferContent
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 400
JSON Response
{ "errorCode": "-97", "errorKey": "!csUnableToChangeItemOwner!csRequiredParameterMissing,dTargetUserID", "errorMessage": "Change of item ownership has failed. Parameter 'dTargetUserID' required by the requested service is missing.", "title": "Change of item ownership has failed. Parameter 'dTargetUserID' required by the requested service is missing.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 3
The following example requests the transfer of UserB
content to UserA
logged in as UserA
.
POST .../users/UserB/transferContent
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{ "errorCode": "-20", "errorKey": "!csUnableToChangeItemOwner!csCloudServiceInsufficientPrivileges,UserA,TRANSFER_USER_CONTENT", "errorMessage": "Change of item ownership has failed. User 'UserA' has insufficient privilege to run service TRANSFER_USER_CONTENT.", "sourceUserID": "UserB", "targetUserID": "UserA", "title": "Change of item ownership has failed. User 'UserA' has insufficient privilege to run service TRANSFER_USER_CONTENT.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 4
The following example requests the transfer of UserB
content to nonexistent UserAA
.
POST .../users/UserB/transferContent
Request Header
None.
Request Body
{ "targetUserID": "UserAA" }
HTTP Status Code
HTTP_STATUS = 404
JSON Response
{ "errorCode": "-16", "errorKey": "!csUnableToChangeItemOwner!csUserNotFound,UserAA", "errorMessage": "Change of item ownership has failed. User or group 'UserAA' doesn't exist.", "sourceUserID": "UserB", "targetUserID": "UserAA", "title": "Change of item ownership has failed. User or group 'UserAA' doesn't exist.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 5
The following example transfers a single folder from UserB to UserA. Only the folder identified by F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F will be moved into a new folder called Documents From UserB, which will be created in the UserA home folder. This new folder will be shared with UserB automatically.
POST .../users/UserB/transferContent
Request Header
None.
Request Body
{ "targetUserID": "UserA", "idList": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "count": "1", "errorCode": "0", "idList": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F", "items": [ { "id": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F", "type": "folder", "name": "transferFolder", "parentID": "FCAF58C2CE2809226608A7A0D470065164CFA8E5008C", "createdTime": "2022-06-07T21:16:38Z", "modifiedTime": "2022-06-07T21:17:51Z", "size": "27436", "childItemsCount": "3", "childFolderCount": "0", "childFileCount": "3", "createdBy": { "displayName": "ssvrint.userb", "id": "U50736B544D00DF1EED770AC72F1B43EEA1F", "loginName": "ssvrint.userb", "type": "user" }, "modifiedBy": { "displayName": "ssvrint.cecsadmina", "id": "UB3646EFBB265068EB229B3BFB30A8BDA1F1", "loginName": "ssvrint.cecsadmina", "type": "user" }, "ownedBy": { "displayName": "ssvrint.usera", "id": "UF23FCDFA872215F048C7EFE6B94D85A1DFA", "loginName": "ssvrint.usera", "type": "user" } } ], "sourceUser": { "displayName": "ssvrint.userb", "id": "ssvrint.UserB", "loginName": "ssvrint.userb", "type": "user" }, "targetUser": { "displayName": "ssvrint.usera", "id": "ssvrint.UserA", "loginName": "ssvrint.usera", "type": "user" }, "type": "folder" }