I created a sample console application in C# that uses the PWSearchWrapper.dll assembly that Dave Brumbaugh provides to show a way to create global saved searches (datasource or for a specific work area).
You can get the source code here: https://github.com/DanWilliamsAtBentleyDotCom/Sample-CSharp-CreateSavedSearch
You can get Dave's MostOfDavesClasses here: https://github.com/DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise
Here's a comment from the source that you should take a look at to set your expectations of what this sample can do:
//////////////////////////////////////////////////////////////////////////////////////// // NOTES: // PWSearch.CreateSearch() is NOT a full implementation of the features found in either // "Search Form" or "Search Builder" available in ProjectWise Explorer. You can create // save searches using those client tools, or with CreateSearch() to create saved // searches that will never select any documents because the constraints are not // such that there are never any documents that will meet the constraints. // However, the tools provided in ProjectWise Explorer limit your choices to much more // reasonable criteria, while CreateSearch() used by this sample ASSUMES that you, as the // caller, are passing reasonable combinations of parameters. For example, you cannot // select both "AnyWord" and "WholePhrase" using ProjectWise Explorer, but you can // specify both in your call to CreateSearch(), but only documents meeting both the // AnyWord and the WholePhrase constraint will be returned by your search, which // effectively is just the ones meeting the WholePhrase constraint! // Also, it is possible to creates search criteria using CreateSearch() that is valid // (and works!), but "Search Form" and "Search Builder" don't know how to interpret // the saved criteria if you load your search into either. In those cases, you will // see "Unknown criterion" listed in the search dialog. // Please also note that CreateSearch() does not support the "OR Group" feature found // in the tools in ProjectWise Explorer. You can implement all those features as well // as any of your own "features" yourself using the native ProjectWise SDK APIs. // Unfortunately, creating saved searches is a relatively complex and tedious task // as well as requiring you, the developer, to understanding what combinations of // search criteria are valid. ////////////////////////////////////////////////////////////////////////////////////////
Please let me know if the samples I am posting are helping you (or not), and feel free to ask for more samples. I can't promise anything in advance, but I'd like to help as much as I can.
Enjoy!