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
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now
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
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now -
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.
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives