When I try to create a Content Document (File) in apex, it creates one with no facility to revise or add new version. However if I use the UI to create a file it gives me a link to add new version. Here's the code I use to create the file:
ContentVersion contentVersion = new ContentVersion( Title = 'Test anonymous 4', PathOnClient = 'Test anonymous 4.txt', VersionData = EncodingUtil.Base64Decode('Test Anonymous 1'), IsMajorVersion = true ); insert contentVersion;
I'm using API version 42 for my class and page and I'm running this as a system admin. I have tried executing the code in 'execute anonymous' window and it does the same. Is there anything I've missed out?
File created using Apex File created using UI