Document creation within plugin

I am trying to create a document inside a plugin code and write data into it. Could someone please help.

 

Regards,

Soujanya

  Discussion posts and replies are publicly visible

Parents Reply
  • Hey,

    You can try using the upload method from ContentService

    ContentOutputStream upload(Document doc,

                              java.lang.Integer unique)

                       throws InvalidContentException,

                              StorageLimitException,

                              PrivilegeException,

                              InsufficientNameUniquenessException,

                              DuplicateUuidException

    Creates a document and provides an output stream to which the document's content should be written. The document is created using the createApproval(Content, Integer) API. The caller must write the document's data to the returned output stream and complete the upload by calling ContentOutputStream.close(). Invoking the stream's close method will calculate the size of the data written to the stream and save it as metadata for the document.

    the stream returned can be used to write like any other plain java stream.

    for more details, check the ContentService public API definition from developers tab of community.

    Hope this helps!

Children
No Data