on 12-11-2006 8:10 AM
Hi everyone
Can anyone help me How to get the list of documents residing in a folder of KM repository of SAP Netweaver using a simple java program
Thanks in ADV.
Rupesh Khemka
Hi Rupesh,
I have written the code for you and it works with WebDynpro, no seperate java program is required.
Just try to paste it in your application code and run it.
try{
// Will check the user athentication for EP
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
// The path in which your folder resides
RID rid1 =RID.getRID("/documents/Public Documents/SCAP/");
IResourceFactory factory1 = ResourceFactory.getInstance();
ICollection icollection = (ICollection)factory1.getResource(rid1, context);
IResourceList resourcelist = icollection.getChildren();
int size1 = resourcelist.size();
for(int s=0; s<listOfDocuments.getLength(); s++){
IResource resource = resourcelist.get(i);
InputStream input = new InputStream();
input = resource.getContent().getInputStream();
}
}catch(Exception e){
e.getMessage();
}
Once you get the InputStream everything else is possible....
This will surely help you in reading the documents from KM.
Regards,
Rekha Malavathu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rekha..
Thanks for ur useful answer... But i m making a application that require a simple java code or say a servlet program that can fetch the list of all the text file or say HTML files that are residing in a particular folder of KM repository... Ur code was using WebDynpro..... which my application doesn't want..Can u plz help me in getting this problem solved....
Can u Divert ur code to my mail box..
rupeshkhemka@hcl.in
Thanks for ur concern & response
Rupesh Khemka
<b>Try using</b>
com.sapportals.portal.security.usermanagement.IUser adminUser = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
ResourceContext context = new ResourceContext(adminUser);
<b>//and the same code you already have.</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.