Highlighted
New Member.
1174 views

file deleted by

Hi,


How can I get the information about who deleted the file?

Here is what I have tried

public void itemRemoved(ItemEvent arg0) {
                File deletedfile = arg0.getOldItem().getDeletedBy();

but it returns null value.

0 Likes
2 Replies
Highlighted
New Member.

RE: file deleted by

pls read as

user deletedfile = arg0.getOldItem().getDeletedBy();

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: file deleted by

Finding out who deleted the file is a bit tricky, since arg0.getNewItem() returns NULL by design (the file has been deleted, after all). and arg.getOldItem().getDeletdBy() returns NULL, since the old item was not deleted...

here's what i suggest you do.

if a deleted event comes by, add the old item to a deleted queue for processing. (never block the event thread)

on a separate dedicated thread, process entries in the deleted queue.

for each deleted item, open a RecycleBin at the tip 'now', get all files & look for the deleted file

effectively...

RecycleBin rb = view.getRecycleBin();

rb.getViewMembers(server.getTypes().FILE).find(getOldItem.getVMID()).getDeletedBy()

then close the recyclebin. rb.close() and release all its resources.

RecycleBin processing is quite expensive, but you shouldn;t typically expect too many files to be deleted, so I imagine you'll get away with this...

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.