Remove User API

Hello,
I am attempting to remove a user and transfer their files to another user.
Although the API documentation is clear, I am not getting the desired results.
User gets deleted, but the sheets never get transferred:
constย optionsย =ย {
ย ย ย ย ย ย ย ย id:ย personToDelete.id,
ย ย ย ย ย ย ย ย transferSheets:ย true,
ย ย ย ย ย ย ย ย transferTo:ย userToTransferTo.id,
ย ย ย ย }
ย ย ย ย constย deleteResultย =ย awaitย smartsheet.users.removeUser(options);ย
ย ย ย ย console.log(deleteResult);
I get { message: 'SUCCESS', resultCode: 0 } from this operation, but the files do not get transferred.
This is what I am following:
https://smartsheet-platform.github.io/api-docs/?javascript#remove-user
The person I am trying to transfer the sheets to is a Licensed user, Resource Viewer, Group Admin, and System Admin, whose account status Active.
I appreciate any guidance.
Thanks,
Tanyar
Best Answer
-
It looks like you need to add an additional level into the options object calledย
queryParameters
So, instead of options.transferSheets it should be:ย
options.queryParameters.transferSheets
ยThe same adjustment would need to be made for transferTo. Does that make sense? You can see an example of adding queryParameters on this page, here:
https://smartsheet-platform.github.io/api-docs/#query-strings
Let me know if this works for you!
Cheers,
Genevieve
Need more information? ๐ | Help and Learning Center
ใใใซใกใฏ (Konnichiwa), Hallo, Hola, Bonjour, Olรก, Ciao!๐ | Global Discussions
Answers
-
It looks like you need to add an additional level into the options object calledย
queryParameters
So, instead of options.transferSheets it should be:ย
options.queryParameters.transferSheets
ยThe same adjustment would need to be made for transferTo. Does that make sense? You can see an example of adding queryParameters on this page, here:
https://smartsheet-platform.github.io/api-docs/#query-strings
Let me know if this works for you!
Cheers,
Genevieve
Need more information? ๐ | Help and Learning Center
ใใใซใกใฏ (Konnichiwa), Hallo, Hola, Bonjour, Olรก, Ciao!๐ | Global Discussions
-
Thank you @Genevieve P !!!
For anyone else looking for further help with this, here is the solution:
constย optionsย =ย {
ย ย ย ย ย ย ย ย id:ย personToDelete.id,
queryParameters: {
ย ย ย ย ย ย ย ย transferSheets:ย true,
ย ย ย ย ย ย ย ย transferTo:ย userToTransferTo.id,
}
ย ย ย ย }
ย ย ย ย constย deleteResultย =ย awaitย smartsheet.users.removeUser(options);ย
ย ย ย ย console.log(deleteResult);
Thanks,
Tanyar
-
Thanks for sharing your final solution! I'm glad you figured it out.
Need more information? ๐ | Help and Learning Center
ใใใซใกใฏ (Konnichiwa), Hallo, Hola, Bonjour, Olรก, Ciao!๐ | Global Discussions