I have ~1000 Knowledge Articles that need to be updated. I've come across this class to accomplish this programmatically. Although I'm getting the following error every time I try to call one of these methods.
System.HandledException: You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.
This is the code that generated the error:
for(Article_Type__kav k : [SELECT Id, ArticleNumber, KnowledgeArticleId
FROM Article_Type__kav
WHERE PublishStatus = 'Online'
AND Language = 'en_US']){
String onlineK=KBManagement.PublishingService.editOnlineArticle(k.KnowledgeArticleId,false);
}
I've tried the same using the KnowledgeArticleVersion and filtering by type as well. Same error. I'm running this as a system administrator and am able to create/edit/update/delete/publish articles through the UI as well. Is there a permission I'm missing to utilize the PublishingService
class? Any help is greatly appreciated.