Attachments vs Discussion with Attachments
Am using below Smartsheet API to get all the attachments. It brings the attachments from attachments and attachment available under Discussion. No problem in that.
smartsheetclient.Attachments.get_attachment(sheet_id, attachment_id)
While deleting the attachments using the below API. Here the problem is attachments section delete works fine and attachment under discussion give permission error. Am using admin user token to get and delete this file.
smartsheetclient.Attachments.delete_attachment(sheet_id, attachment_id)
Am not able to get attachment under discussion objects. Below is the reference and used the same code. However there is no attachments under discussions -> Array objects.
Answers
-
Hi @karthick
Were you able to figure this out? I was able to delete the attachment by getting the attachment id using GET attachment, and then using that ID in the Delete Attachment.
Here's how I did it in Postman:
Then
I did get a permission error when I was using an Admin access token trying to delete someone else's attachment, so I would suggest ensuring that your token is the appropriate one to make a deletion. Try the same action but ensure you're the one who uploaded the attachment.
Another option, if this is uploaded by someone else, would be to delete the entire discussion which would remove the image at the same time.
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Thanks @Genevieve P. for your response. Moreover I found the similar findings. We cannot delete attachment uploaded by others. If we delete the entire discussion then that discussion contains attachment also will get deleted.
Thanks for you reply and spending valuable time on this.
-
If you are accessing the API via an Admin account, you should be able to use the "Assume User" option on your API requests to impersonate the user who created the Discussion attachment.
I have not done this exact usage on Discussion Attachments, but. I have used Assume User to create discussion messages on behalf of a user.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives