今天我尝试在我的 wcm 门户上创建 LibraryImageComponent 或 LibraryFileComponent。代码如下:
workspace = createWorkspace();
DocumentLibrary documentLib = workspace.getDocumentLibrary(Config.LIBRARY_NAME);
workspace.setCurrentDocumentLibrary(documentLib);
workspace.login();
try {
LibraryFileComponent file = workspace.createFileComponent();
file.setName("FileUploadDemo");
File f = new File("C:/Users/huyenlt/Desktop/TinVeBIDV/TinVeBIDV/files/94747249_38ba_48fb_b150_7267fd7a1c9aCTR_KTA___GS_UBKT_2018.doc");
file.setResource("helo",f);
file.setFile("helo",f);
workspace.save(file);
}
catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
}