How to search for every file owned by any user in Workgroup

EmailFacebookGoogle+LinkedInTwitterShare

Recently a customer asked me to write a routine to release ownership of every file in his SOLIDWORKS Workgroup PDM vault.

I thought finding the files would be rather simple until I realized Workgroup’s PDMWSearchOptions (Workgroup’s API search function) does not support wildcard characters. While contemplating harakiri, I finally came up with this search criteria idea:

objSearch.IgnoreCase = True
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "a"
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "e"
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "i"
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "o"
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "u"
'sometimes
objSearch.SearchCriteria.AddCriteria pdmwOr, pdmwOwner, "", pdmwContains, "y"

As long as I don’t have any Workgroup users from one of those countries that do not have any vowels in their names, this search gave me every file in the Workgroup vault that was owned by a user. It isn’t a lightening fast search, but did a nice job.