Closed Sevillesilveira closed 10 months ago
Hi @Sevillesilveira
Thanks for using our Python SDK, I tried to use folder locks from my account but it's working as expected.
To further more investigate this issue, can you use the get_locks
function to see if actually a lock created for the folder.
If there is a lock with move and delete locked, but you still able to move or delete folder, it's an unexpected behavior for the Box API, so you can send this question to Box Support and they will check it deeper.
Best regards, Minh
Thank you @congminh1254 I was able to lock the folders later on but the files in these folders can still be moved. Is there a way to prevent the files in the locked folders from being edited or moved to a different location.
Hi @Sevillesilveira
Sorry for the confusion, but the folder locked is not affecting for the file inside folder. If you want to lock multiple files, unfortunately it's not able to do it in single request.
By using this client.file(file_id).update_info
method, you can create lock for single file with an expiring time. This prevents the item from being moved, renamed, or otherwise changed by anyone other than the user who created the lock.
Best,
Minh
Hi @congminh1254 Could you provide me with the code to prevent files from being moved. I am unable to get the file information in JSON format in VS Code and I don't know how each parameter is named for the files. The above image is the output I get after retrieving the file information which is only the name and id of the file.
The code is as below: lock = client.folder(folder_id='233490176640').create_lock() print(f'Created a lock with ID {lock.folder.id}')
The output:
But I am still able to move the files in this particular folder and even delete it. Kindly let me know how to resolve this issue.