Tuesday, 10 May 2016

Creating folder and sub folder in CE (CE API)

// Creating folder and sub folder in CE (CE API)

public void createCEFolder(Connection conn) {    //FileNet CE Connection 

try {
//fetching Domain
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
//fetching Object Store
ObjectStore objStore = Factory.ObjectStore.fetchInstance(domain,"OSNAME", null);
System.out.println("Object Store ="+ objStore.get_DisplayName() );

//Creating Root folder 
com.filenet.api.core.Folder testFolder= Factory.Folder.createInstance(objStore,null);
com.filenet.api.core.Folder rootFolder= objStore.get_RootFolder(); 
System.out.println(rootFolder);
testFolder.set_Parent(rootFolder);
testFolder.set_FolderName("NewFolder"); //Folder Name
testFolder.save(RefreshMode.REFRESH);

//Creating Sub folder
com.filenet.api.core.Folder subFolder= testFolder.createSubFolder("newSubFolder");
subFolder.save(RefreshMode.REFRESH);

} catch (Exception e) {
e.printStackTrace();
}
}

No comments:

Post a Comment