Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi friends,
How to delete the primarycontent of teh Document using api can you help me out.
Regards,
Sandeep
Solved! Go to Solution.
Following works with Windchill 10.2 M10
private boolean removePrimaryContent(final WTDocument wtDoc) {
boolean isSuccess = false;
ContentItem contentItem = null;
try {
contentItem = ContentHelper.service.getPrimary((FormatContentHolder)wtDoc);
if(contentItem != null){
System.out.println("deleting contentItem: " + contentItem.getDisplayIdentity());
PersistenceHelper.manager.delete(contentItem);
isSuccess = true;
}
} catch (WTException | PropertyVetoException e) {
isSuccess = false;
e.printStackTrace();
}
return isSuccess;
}
Following works with Windchill 10.2 M10
private boolean removePrimaryContent(final WTDocument wtDoc) {
boolean isSuccess = false;
ContentItem contentItem = null;
try {
contentItem = ContentHelper.service.getPrimary((FormatContentHolder)wtDoc);
if(contentItem != null){
System.out.println("deleting contentItem: " + contentItem.getDisplayIdentity());
PersistenceHelper.manager.delete(contentItem);
isSuccess = true;
}
} catch (WTException | PropertyVetoException e) {
isSuccess = false;
e.printStackTrace();
}
return isSuccess;
}
Hi yogesh,
Thank you,It is Working.
regards,
Sandeep