Nguyễn Tuấn
Nguyễn Tuấn

Reputation: 37

WCM API :Can't set File or Image for LibraryFileComponent or LibraryImageComponent

Today i try to create LibraryImageComponent or LibraryFileComponent on my wcm portal. Code as below :

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();
}
}

Upvotes: 0

Views: 121

Answers (0)

Related Questions