Vulnerability in EPiServer.Forms
I'm trying to create a ContentApprovalDefinition when creating a block. This is done to be able to exclude some specific block types from the content approval process.
I'm using the following code from an init module on its CreatedContent event:
definition = new ContentApprovalDefinition()
ContentLink = e.ContentLink,
Steps = GetApprovalSteps()
var clone = definition.CreateWritableClone();
but it gives me the following exception when saving the clone:
ApprovalDefinitionOperationException: Not allowed to create a ContentApprovalDefinition on an item inside a content folder
Any ideas why it is not allowed for blocks to create a definition, or if there's any way to allow it? (It works just fine using pages)
Hi Johan, Please see this thread hope it helps you. https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2017/10/turn-off-content-approvals-on-assetfolders/
Thanks for your answer!
Unfortunately, I couldn't get that solution to work for blocks. I still get the same exception, even if the block has been published.
And in the case linked above, the user wanted the image to be published on create which is not what I want. The content should still be unpublished after creating it, but ready to be set to status "RequestingApproval" if the block is of a specific type.
Any other ideas?