Is there a OOTB functionality to empty the contents of KC or to get all the top

Is there a OOTB functionality to empty the contents of KC or to get all the top level folders present in KC?...

OriginalPostID-121528

OriginalPostID-121528

  Discussion posts and replies are publicly visible

Parents
  • 1. You can use the Content Functions as an example to create your own custom function plug-in to retrieve all folders from a KC. Here's an example:

    @Function
    @FolderDataType
    public Long[] GetAllFoldersFromKC(ServiceContext sc, ContentService cs, @Parameter(required=true) @KnowledgeCenterDataType Long knowledgeCenter) {
    ContentFilter cf = new ContentFilter(ContentConstants.TYPE_FOLDER);
    return cs.getAllChildrenIds(knowledgeCenter, cf, ContentConstants.GC_MOD_NORMAL);
    }


    2. Then you can pass the result of calling this function to the Empty Folder smart service available in the second plug-in from my post

    3. You can now use the Delete Folder smart service to delete the empty folders that function #1 will return.

    Or you can merge these three things in your own custom smart service called "Empty KC"
Reply
  • 1. You can use the Content Functions as an example to create your own custom function plug-in to retrieve all folders from a KC. Here's an example:

    @Function
    @FolderDataType
    public Long[] GetAllFoldersFromKC(ServiceContext sc, ContentService cs, @Parameter(required=true) @KnowledgeCenterDataType Long knowledgeCenter) {
    ContentFilter cf = new ContentFilter(ContentConstants.TYPE_FOLDER);
    return cs.getAllChildrenIds(knowledgeCenter, cf, ContentConstants.GC_MOD_NORMAL);
    }


    2. Then you can pass the result of calling this function to the Empty Folder smart service available in the second plug-in from my post

    3. You can now use the Delete Folder smart service to delete the empty folders that function #1 will return.

    Or you can merge these three things in your own custom smart service called "Empty KC"
Children
No Data