Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
27 replies
Subscribers
5 subscribers
Views
7861 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
How to upload fies to Knowledge center via Content Service
Shivam Gupta
over 8 years ago
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
0
Shivam Gupta
over 8 years ago
@sidhantb from where did i fetch the parent folder id
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sidhant Behura
over 8 years ago
Its as simple as passing inputs in the Data tab of a Smart service. You can get folder id using tointeger(pv!foldervariable).
This is solely your decision your where you want to upload the document. Whichever folder you decide become the parent folder.
Hope this clears your doubt.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shivam Gupta
over 8 years ago
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
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shivam Gupta
over 8 years ago
@sidhantb if go back with ur old way that u suggested
how to convert a document of Document(class) Type to output stream ??
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shivam Gupta
over 8 years ago
@sidhantb @vinodb
when calling the upload method
ContentOutputStream outStream = cs.upload(doc, arg1);//here cs is an instance of content service
for that i have to create and instance of content service
ServiceContext sc = (new ServiceLocator()).getAdministratorServiceContext();
ContentService cs = ServiceLocator.getContentService(sc);
which is described in the documentation
and i got this error
java.lang.NoClassDefFoundError: Could not initialize class com.appiancorp.services.WebServiceContextFactory
\tat com.appian.fileupload.FileUploadServlet.doPost(FileUploadServlet.java:99)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
kumara2
over 8 years ago
Hi @Shivamg, Any luck or progress made?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shivam Gupta
over 8 years ago
@kumar2 no got the concept but some problems are occurring in eclipse code
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
<