Community Tip - You can change your system assigned username to something more personal in your community settings. X
Please let me know the API to use..
Below is used in 10.1, hopefully works in 10.2, if not may need little modifications .
ImportJob job = new ImportJob();
ImportSpec importSpec = new ImportSpec();
WTContainer myContainer = part.getContainer();
ApplicationData appData =<Get you application Data Here, the spreadsheet attached to part/ doc etc..>
importSpec.setContainerRef(WTContainerRef.newWTContainerRef(myContainer));
importSpec.setAction(ImportAction.ADD_ONLY);
importSpec.setPreview(true);
importSpec.setFilename(appData.getFileName());
job.setSpec(importSpec);
job.setStatus(ImportJobStatus.DEFINING);
OwnershipHelper.setOwner(job, SessionHelper.manager.getPrincipal());
AdminDomainRef admindomainref = myContainer.getDefaultDomainReference();
job.setDomainRef(admindomainref);
job.setContainerReference(WTContainerRef.newWTContainerRef(myContainer));
ImportJobEvent importjobevent = new ImportJobEvent(ImportJobEvent.CREATED, job);
ImportExportEventHelper.service.dispatchVetoableEvent(importjobevent, importjobevent.getEventKey());
job = (ImportJob) PersistenceHelper.manager.save(job);
wt.content.ContentHolder contentHolder = (wt.content.ContentHolder) job;
ApplicationData applicationData = ApplicationData.newApplicationData(contentHolder);
applicationData.setRole(ContentRoleType.PRIMARY);
applicationData.setFileName(appData.getFileName());
ContentServerHelper.service.updateContent(contentHolder, applicationData, filePath);
job = StandardImportService.importSpreadsheet(job.getPersistInfo().getObjectIdentifier());
System.out.println("job status ---> "+job.getStatus().getDisplay());
Hi,
Thanks for helping.
It worrked fine in Windchill 10.2 M030 also.