cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Translate the entire conversation x

How to delete the primarycontent of teh Document using api.

saitha
1-Visitor

How to delete the primarycontent of teh Document using api.

Hi friends,

How to delete the primarycontent of teh Document using api can you help me out.

Regards,

Sandeep

ACCEPTED SOLUTION

Accepted Solutions
ybagul
12-Amethyst
(To:saitha)

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;

}

View solution in original post

2 REPLIES 2
ybagul
12-Amethyst
(To:saitha)

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;

}

saitha
1-Visitor
(To:ybagul)

Hi yogesh,

Thank you,It is Working.

regards,

Sandeep

Announcements

Top Tags