Error Description:
When I tried to export a file through code-
doExport("/Temp/test1/test_doc","C:\\AMIT_VERMA\\New Folder\\","test_doc","Excel 2007 Workbook",dfSession);I am getting the following error message:**********************************************************************
java.lang.NullPointerException
at com.documentum.operations.DfOperation.getFileExtensionToUse(DfOperation.java:2026)
at com.documentum.operations.DfGetContentFile.getDefaultOutputFile(DfGetContentFile.java:91)
at com.documentum.operations.DfGetContentFile.getContentFile(DfGetContentFile.java:848)
at com.documentum.operations.DfGetContentFile.execute(DfGetContentFile.java:61)
at com.documentum.operations.DfOperationStep.execute(DfOperationStep.java:135)
at com.documentum.operations.DfOperation.execute(DfOperation.java:432)
at ExportDoc.doExport(ExportDoc.java:230)exception is:null
**********************************************************************
Method Code:public static void doExport( String strPath, String destDir,
String exportName, String exportFormat, IDfSession session )
throws DfException {
IDfClientX clientx = new DfClientX();
IDfSysObject sysObj = (IDfSysObject) session.getObjectByPath( strPath );
if( sysObj == null ) {
System.out.println("Object " + strPath + " can not be found.");
return;
}
else{
System.out.println("Object " + strPath + " has been found.");
}
sysObj.setObjectName(exportName);
System.out.println("export name is " + exportName);
IDfExportOperation operation = clientx.getExportOperation();
operation.setDestinationDirectory( destDir );
System.out.println("destDir name is " + destDir);
IDfExportNode node = (IDfExportNode)operation.add( sysObj );
node.setFormat( exportFormat );
System.out.println("exportFormat name is " + exportFormat);
operation.execute();
System.out.println( "exported file path: " + node.getFilePath() );
}
*************************************************************************
Resolution:I have successfully called the method with slight correction of export format -doExport("/Temp/test1/test_doc","C:\\AMIT_VERMA\\New Folder","test_doc","excel12book",dfSession);***************************************************************************
You can get more details format's name for each file type by -
Documentum Administrator -> Formats
It displays the format's name and description. The DOS extension is not showed, but you can see it on it's Info page.
Or you run a query like this:
SELECT name, dos_extension FROM dm_format WHERE dos_extension='docx'