cancel
Showing results for 
Search instead for 
Did you mean: 

Get file list of Folder

Former Member
0 Kudos

Hello!

I'm just a beginner in KM, that's why have some simple questions.

I want to get List of files in folder, like that list appear in "KM Content" in Administration.

What code will solve my problem?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Seems like I found solution:


ICollection currentFolder = null;
currentFolder =(ICollection) ResourceFactory.getInstance().getResource(rid,context);
IResourceList children = null;
children = currentFolder.getChildren();
children.get(i).getName().toString()

But can I get GUID of file? Can't find solution for this..

Former Member
0 Kudos

The GUID really isn't part of the KM resource, but assigned by a service (which you'll have to query). I think the service is called the IdMapper service, but I may be confusing it with something else.

Former Member
0 Kudos

Found Example:

import com.sapportals.wcm.service.urimapper.IUriMapperService;
IUriMapperService ums = UriMapperServiceFactory.getInstance();

But I can't find library that contents UriMapperServiceFactory.

(com.sapportals.wcm.service.urimapper.UriMapperServiceFactory)

Any body know where that lib is located? Or e-mail to me?

Former Member
0 Kudos
Former Member
0 Kudos

Thanks, but I don't understand what should I do with ServiceFactory Instance after?

Former Member
0 Kudos

Hi,

about gettong the GUID from RID see my reply here: [https://www.sdn.sap.com/irj/sdn/thread?messageID=6077407#6077407|https://www.sdn.sap.com/irj/sdn/thread?messageID=6077407#6077407]

The required lib you can find on portal filesystem here:

\usr\sap\XXX\JCXX\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urimapper_api.jar

Hope that helps,

Romano

Former Member
0 Kudos

Thanks, But on this line raise exception:

IUriMapperService uriservice = (IUriMapperService )ResourceFactory.getInstance().getServiceFactory().getService("UriMapperService");

An exception occurred while processing a request for :

iView : N/A

Component Name : N/A

com.sapportals.wcm.service.urimapper.IUriMapperService.

Former Member
0 Kudos

Hi,

not sure (you should send the stackTrace from the defaultTrace.log) but maybe you have forgot to add the sharing reference to the portalapp.xml of your project:


...
<application>
  <application-config>
    <property name="SharingReference" value="knowledgemanagement"/>
  </application-config>
  <components>
...

Romano

Former Member
0 Kudos

Thanks, Romano Bodini. That is!

But now I have next problem:

uriMapperService don't have method like getRIDFromGuidRID

Former Member
0 Kudos

Hi Paul,

for sure it has...at least in my portal version...this works for me - I've tried:


      RID rid = RID.getRID("/documents/"); 
      IUriMapperService uriMapperService = (IUriMapperService) ResourceFactory.getInstance().getServiceFactory().getService("UriMapperService");
      RID guid = uriMapperService.getGuidRIDFromRID(rid); //  "493a20804adfb2be5ba2980b435501a8-989g75632safr4df7ga2980b894742a8";
      RID rid2 = uriMapperService.getRIDFromGuidRID(guid); // /documents
      response.write("RID:" + rid + ", GUID:" + guid + ", RID2:" + rid2);

What is your EP version?

Romano

Former Member
0 Kudos

Hi Paul,

What is your EP version?

I have Netweaver 7.0 SP09, EP6.0

Maybe I have old library(jar)? Can You e_mail me your lib jar?

Or Maybe file guid was embeded in newer SP of portal?

Former Member
0 Kudos

Paul,

I've sent you the JAR required. That portal version should work...in fact I work on an older one - EP6 SP19 or something like this ;o) - but I have found it also in the 7.0 library.

Regards,

Romano

Former Member
0 Kudos

Romano Bodini, thanks very much!

Imported your lib, but necessary method didn't appear

I have no ideas now..

Former Member
0 Kudos

Uff

...impossible, check your mail - I'm sending you a testing project - try it and let me know...

Romano

Former Member
0 Kudos

Thanks! Your program compiled fine and methods exist!

It's kind of mysticism

Looks like some lib imported in my project overlaps. Didn't know if can be like that..

Former Member
0 Kudos

Glad to hear that...

...please mark this thread as solved - it will help others to find the information they need.

Romano

Answers (1)

Answers (1)

Former Member
0 Kudos

Would you be using WebDynpro to display?

Thanks,

GLM

Former Member
0 Kudos

Using JSPDynpage