AI OnAI Off
The approvals wasn't the problem, it was the parents publish rights. Solved it by automatically publishing it when created:
public void Initialize(InitializationEngine context)
{
IContentEvents events = ServiceLocator.Current.GetInstance<IContentEvents>();
events.CreatedContent += CreatedContent;
}
private void CreatedContent(object sender, ContentEventArgs e)
{
if (e.Content != null && e.Content is ImageData)
{
SetPublished(e.Content as ImageData);
}
}
private void SetPublished(ImageData content)
{
if (content.IsPendingPublish)
{
var clone = content.CreateWritableClone() as ImageData;
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
contentRepository.Save(clone, SaveAction.Publish, AccessLevel.NoAccess);
}
}
CMS 10.10
I'm trying to disable programmatically the legacy of populating down Approval Sequence to local asset folder "for this page".
"ApprovalDefinitionOperationException: Not allowed to create a ContentApprovalDefinition inside a local asset folder"
Even if I have a Approval Sequence on a page, I don't want its behavior on un uploaded image under "for this page", I want the image to be published automatically.
Any ideas?