This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Restrict files size limit to avoid users add large files

Former Member
Former Member
Hi All,

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