How to upload fies to Knowledge center via Content Service

I am working on a plugin creation that uploads a file to Knowledge center from your system
i know that i have to use contentService
but in contentService their is function named "upload(Document doc, java.lang.Integer unique)" which returns ContentOutputStream instance
but i am unable to understand how the document is getting saved into Knowledge center.
Anyone please help struck in this for a while

Thanks in advance

OriginalPostID-235089

  Discussion posts and replies are publicly visible

Parents
  • ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
    ContentService cs = ServiceLocator.getContentService(sc);
    Long rulesRootId; rulesRootId=cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);
    Approval approval = null;
    String filePath = null;
    ContentOutputStream cos = new ContentOutputStream(cs, rulesRootId, approval, filePath);


    here i dn't know what to give in approval and what to provide in filepath
    and also i m using upload method which returns ContentOutputStream value ...
    but upload method isn't showing as it is a method of interface ContentService

    don't know how to do
Reply
  • ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
    ContentService cs = ServiceLocator.getContentService(sc);
    Long rulesRootId; rulesRootId=cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);
    Approval approval = null;
    String filePath = null;
    ContentOutputStream cos = new ContentOutputStream(cs, rulesRootId, approval, filePath);


    here i dn't know what to give in approval and what to provide in filepath
    and also i m using upload method which returns ContentOutputStream value ...
    but upload method isn't showing as it is a method of interface ContentService

    don't know how to do
Children
No Data