The following code illustrates how to create folders in Knowledge Management using Webdyno APIs.This comes as an extension of the weblog I posted earlier ie for uploading files to KM repository . If you want to classify the documents uploaded in KM into specific folders at runtime.
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
//create an ep5 user from the retrieved user IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID(wdContext.currentContextElement().getPath());
IResourceFactory factory = ResourceFactory.getInstance();
//get an instance of the current folder under which we have to create subfolders ICollection folder = (ICollection)factory.getResource(rid,context);
ICollection newfolder = folder.createCollection(newFolderName,null,null);
This createCollection() will create a new collection and additional system resources the collection needs.This newFolderName specifies the name of the new folder to be created.