Deleting of all Windchill Documents using a custom utility
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Labels:
-
API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
