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

Deleting of all Windchill Documents using a custom utility

aachanta
15-Moonstone

Deleting of all Windchill Documents using a custom utility

Hi,

 

Can someone please let me know how to delete the documents in a container using a custom utility. 

 

Which API has to be used accordingly. Can anyone share me the code snippet if possible.

 

Thanks and Regards,

Aditya

2 REPLIES 2
aachanta
15-Moonstone
(To:aachanta)

Hi All,

 

Kindly let me know if there are any inputs regarding the same.

 

Actually within a product if there are many documents resided in multiple folders. How to delete the documents from multiple folders and also outside the folder on one go.

 

Kindly let me know if there is concerned API regarding the same or if there is any utility for the same.

 

Thanks in advance.

 

Best Regards,

Aditya

Hello @aachanta,

To search all WTDocument within context, you can try below snippet. I hope this helps you.

 

QuerySpec qs = new QuerySpec(WTDocument.class);
qs.appendSearchCondition(new SearchCondition(WTDocument.class,WTDocument.NAME,false));
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTDocument.class,"containerReference.key.id", SearchCondition.EQUAL,lib.getPersistInfo().getObjectIdentifier().getId()), new int[]{0});
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);

Although I wrote it to fetch WTDocuments from Library, you can modify it to get WTDocuments from Product.

 

Once you have document you can then use below API to delete them:

 

PersistenceHelper.manager.delete(doc);

 

Thanks,

Shirish

Announcements

Top Tags