问题
Slack API has a method files.list
, however this seems to list only files shared on public channels, not in private conversations.
As a team admin I would like to delete old files (I don't need to see them). I could ask team members to delete them manually, but this is a very slow and laborious process for them.
BTW, I am using a script based on this one
回答1:
I am afraid that is not possible. Even as primary owner (the highest possible level) a user has no access to private channels or direct messages that he is not invited to. Therefore it is not possible to delete those files.
There are 2 workarounds:
1. Admin user
A workaround I am using to mitigate this situation is that I have a special admin user on my Slack team that is required to be member of any private channel. That way I am able to do maintenance work in private channels. However, this approach does not work for direct messages and you need to limit who can create private channels (e.g. only a dedicated admin team) to ensure your special admin user is always a member.
2. Collect user tokens
Another workaround is to collect tokens from all users on your workspace. This can be done by asking every user to install your Slack app once. With each install your app will receive a new user token which it can store for later use.
You can then use those user tokens to query and potentially delete all user related files. e.g. with files.list
来源:https://stackoverflow.com/questions/39833228/how-to-find-and-possibly-delete-personal-files