Hi folks,
I’ve been trying to gather information about deleted files, such as file size and deletion date, but I couldn’t find any method in the PDM documentation to retrieve that data.
On the other hand, you can access this information through the folder’s properties, under the Deleted Files tab.
The IEdmFolder11::GetDeletedItems method only returns the EdmDeletedItems struct.
You’ll have to investigate the file histories for the relevant IDs. Keep in mind that this isn’t like the Windows recycle bin. It won’t show you file size unless you get a version of the file and query that specifically. The vault recycle bin is “deletes” the whole tree.
private static void CheckDeletedFiles()
{
var vault = LogInToSelectedVault();
var folder = default(IEdmFolder11);
var file = default(IEdmFile5);
var history = default(IEdmHistory);
if (vault.IsLoggedIn)
{
folder = vault.RootFolder as IEdmFolder11;
folder.GetDeletedItems(out var poDeletedItems, true);
foreach (var item in poDeletedItems)
{
if (item.mlObjectType == 0) continue;
file = vault.GetObject((EdmObjectType)item.mlObjectType, item.mlFileID) as IEdmFile5;
history = vault.CreateUtility(EdmUtility.EdmUtil_History) as IEdmHistory;
history.AddFile(file.ID);
var ppoRetHistory = default(EdmHistoryItem[]);
history.GetHistory(ref ppoRetHistory, (int)EdmHistoryType.Edmhist_FileDelete);
var date = "N/A";
if (ppoRetHistory.Any())
{
date = ppoRetHistory.FirstOrDefault().moDate.ToLongDateString();
}
Console.WriteLine($"{file.Name}\t{file.CurrentState.Name}\tDeleted On: {date}");
}
}
}