Transfer User Content
/documents/api/1.1/users/{userID}/transferContent
Transfer all user (userID) content 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
-
Type:
stringRequired:trueSpecify the source
userIDfrom where all content will be transferred. User GUID or login can be used.
- targetUserID
-
Type:
stringRequired:trueSpecify the destination
userIDwhere all content will be transferred. User GUID or login can be used.
Response
- application/json
- application/xml
The request was fulfilled.
- displayName
-
Type:
stringThe display name for the user. - id
-
Type:
stringGlobally unique identifier (GUID) for the user. - type
-
Type:
stringItem typeuser.
Example application/json
{
"errorCode":"0",
"sourceUser":{
"id":"U0EAA20910FAF3052ACB79E4T00000000001",
"displayName":"User BB",
"loginName":"userBBLoginName",
"type":"user"
},
"targetUser":{
"id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
"displayName":"User AA",
"loginName":"userAALoginName",
"type":"user"
}
}
Required field is not provided.
Unauthorized access.
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"
}