Description of the Issue
I'm trying to delete all trashed files that are over 90 days old for each user in an account. However when I run the permanently_delete_item() function I get an 404 not found or 403 insufficient permissions. How can I permanently delete trashed files of another user's account as an Admin?
Steps to Reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected Behavior
Error Message, Including Stack Trace
Screenshots
trashed_items = user_client.trash().get_items(limit=5000, fields=('trashed_at', 'name'))
#try:
if trashed_items is not None:
for trashed_item in trashed_items:
trashedDate = trashed_item.trashed_at[0:10]
date_time_obj = datetime.strptime(trashedDate, '%Y-%m-%d')
time_between_insertion = todayDate - date_time_obj
if time_between_insertion.days>90:
writer.writerow([userTarget.login, trashed_item.name, trashed_item.trashed_at, userTarget.id, trashed_item.id])
file_to_delete = user_client.file(file_id=trashed_item.id)
client.trash().permanently_delete_item(file_to_delete)
#put delete logic here
deleteCnt = deleteCnt + 1
del trashed_item
# except:
# writerErr.writerow([user.login, user.id])
print('Deleted {0} items.'.format(deleteCnt))
del trashed_items
Versions Used
Python SDK:
Python:
Description of the Issue
I'm trying to delete all trashed files that are over 90 days old for each user in an account. However when I run the permanently_delete_item() function I get an 404 not found or 403 insufficient permissions. How can I permanently delete trashed files of another user's account as an Admin?
Steps to Reproduce
Expected Behavior
Error Message, Including Stack Trace
Screenshots
trashed_items = user_client.trash().get_items(limit=5000, fields=('trashed_at', 'name'))
#try:
if trashed_items is not None:
for trashed_item in trashed_items:
trashedDate = trashed_item.trashed_at[0:10]
date_time_obj = datetime.strptime(trashedDate, '%Y-%m-%d')
time_between_insertion = todayDate - date_time_obj
if time_between_insertion.days>90:
writer.writerow([userTarget.login, trashed_item.name, trashed_item.trashed_at, userTarget.id, trashed_item.id])
file_to_delete = user_client.file(file_id=trashed_item.id)
client.trash().permanently_delete_item(file_to_delete)
#put delete logic here
deleteCnt = deleteCnt + 1
del trashed_item
Versions Used
Python SDK:
Python: