Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access to a folder in km content in the portal

can i access with web dynpro to get xml documents in a folder located in the km in the portal? do you have code, tutorials or info about that (if is possible)

Thanks a lot

replied

Hello,

here is some source code that may help you:

		
try {
  com.sapportals.portal.security.usermanagement.IUser
   ep5User = WPUMFactory.getServiceUserFactory().getServiceUser(QUICKLINK_USER);
  ResourceContext context = new ResourceContext(ep5User);

  /*Give the path to KM in the variable path */
  RID rid = RID.getRID("folder/path");
  IResourceFactory factory = ResourceFactory.getInstance();
  ICollection folder = (ICollection) factory.getResource(rid, context);

  IResource resource = ResourceFactory.getInstance().getResource(RID.getRID("folder/path/file.xml"), context);	

  if (resource != null) {
    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = dbFactory.newDocumentBuilder();
    Document document = builder.parse(resource.getUnfilteredContent().getInputStream());

    // Here you can do your XML Stuff
  else {
    // File not found error handling goes here
  }

Hope it helps as a start point.

Have a nice weekend,

Frank

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question