I was working on a feature to set a maximum file size adding to M-Files.
I used the following code in CheckInFinalize event, and it works.
BUT This approach still left the failed document in the M-Files and the user needs to delete it. Is there a way to remove the failed document immediately?
Thanks for any advices.
ObjectFiles ofs = env.Vault.ObjectFileOperations.GetFiles(env.ObjVer);
foreach (ObjectFile of in ofs)
{
if (of.LogicalSize > maximumFileSize * MB)
{
throw new Exception("The filesize " + (of.LogicalSize / MB).ToString() + " MB is over the maximum size, " + maximumFileSize);
}
}
BY