Edit Shared Folder User Role
/documents/api/1.2/shares/{folderId}/role
Request
- application/json
- application/xml
-
folderId: string
Globally unique identifier (GUID) for the folder. If the referenced folder is the user's home folder, the value for
.folderId
isself
{
"userID":"U7ECC74059E0FEDFEC66BF5AT00000000001",
"role":"viewer",
"message":"Changing your shared access rights to viewer."
}
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
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",
"id":"F1321DC48E3B123D02DBEE88T0000000000100000001",
"members":[
{
"id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
"displayName":"User BB",
"type":"user",
"isSuccessful":"1",
"provisioningStatus":"active"
}
],
"role":"viewer",
"type":"share",
"user":{
"id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
"displayName":"User BB",
"type":"user"
}
}
400 Response
Request parameters are not formatted correctly.
403 Response
Forbidden if the user does not have manager permission or there was a problem editing role for one or more user or group.
404 Response
Folder ID is not found.
Examples
The following example changes the access level to a given folder to 'viewer' for the specified user and group.
PUT .../shares/F1321DC48E3B123D02DBEE88T0000000000100000001/role
Request Header
None.
Request Body
{ "userID": "U7ECC74059E0FEDFEC66BF5AT00000000001,GS18003", "role": "viewer", "message": "Changing your shared access rights to viewer" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "errorCode": "0", "id": "F1321DC48E3B123D02DBEE88T0000000000100000001", "members": [ { "id": "U6A0B35B0548F250914D18FDB5D17B95F470", "displayName": "User BB", "type": "user", "isSuccessful": "1", "provisioningStatus": "active" }, { "id": "GS18003", "displayName": "Sales Group", "type": "group", "isSuccessful": "1", "provisioningStatus": "active" } ], "role": "viewer", "type": "share", "user": { "id": "U6A0B35B0548F250914D18FDB5D17B95F470,GS18003", "type": "user" } }
Example 2
The following example returns an error because the userID
parameter is missing from the request body.
PUT .../shares/F2CD745706AEC8BD04260B2F45B3E9DD64907CA0D19F/role
Request Header
None.
Request Body
{ "role": "viewer", "message": "granting you shared access" }
HTTP Status Code
HTTP_STATUS = 400
JSON Response
{ "errorCode": "-97", "errorKey": "!csUnableToEditSharingRole!csRequiredServiceParameterMissing,dUserID,EDIT_SHARING_ROLE", "errorMessage": "Failed to change shared user role. Parameter 'dUserID' required by service EDIT_SHARING_ROLE is missing.", "errorType": "share", "id": "F2CD745706AEC8BD04260B2F45B3E9DD64907CA0D19F", "role": "viewer", "title": "Failed to change shared user role. Parameter 'dUserID' required by service EDIT_SHARING_ROLE is missing.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 3
The following example returns an error because the folder ID is invalid.
PUT .../shares/F2CCCC5706AEC8BD04260B2F45B3E9DD64907CA0D19F/role
Request Header
None.
Request Body
{ "userID": "U5C4D5FCE14F2B44946FA74745B3E9DD6490", "role": "manager" }
HTTP Status Code
HTTP_STATUS = 404
JSON Response
{ "errorCode": "-16", "errorKey": "!csUnableToEditSharingRole!csSecurityValidationFailed!csFldDoesNotExist,F2CCCC5706AEC8BD04260B2F45B3E9DD64907CA0D19F!csUnprivilegedSystemError", "errorMessage": "Failed to change shared user role. Security validation failed. 'F2CCCC5706AEC8BD04260B2F45B3E9DD64907CA0D19F' does not exist. The error was caused by an internally generated issue. The error has been logged.", "errorType": "share", "id": "F2CCCC5706AEC8BD04260B2F45B3E9DD64907CA0D19F", "role": "manager", "title": "Failed to change shared user role. Security validation failed. 'F2CCCC5706AEC8BD04260B2F45B3E9DD64907CA0D19F' does not exist. The error was caused by an internally generated issue. The error has been logged.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "user": { "id": "U5C4D5FCE14F2B44946FA74745B3E9DD6490", "type": "user" } }