AI OnAI Off
You need to set access level to NoAccess
:
contentRepository.Save(myContent, SaveAction.Publish, AccessLevel.NoAccess)
When you trigger the scheduled job manually the job is run with your current account, which is usually admin. when it is run automatically I think the account is equivalent to Everyone. that explains why it is not working. Dejan's solution should work, as it basically says that skipping checks for current user access rights when saving.
I have scheduled a job for update and saving data in a page.
While triggering manually the scheduled job is working fine. But when setting scheduled job to automatic, the following error is logged.
Access was denied to content 54321_12345. The required access level was "Edit, Publish".