I'm having problems working with collections. I want to eliminate some entries from a collection based on the contents of another collection.
I have two collections; one holds a set of workflow tasks I have obtained via SPQuery (SPListItemCollection) and the other is a list of users from a people picker (SPFieldUserValueCollection).
I want to get a list (of type SPFieldUserValueCollection) which contains only those users who have not been assigned the workflow task listed in the query.
Short of iterating through the list of users, and comparing the LookupID with the "Assigned To" field on the workflow task (which I really don't want to do), how can this best be done?
I'm looking for an elegant solution.
Another possibility would be to query the user-list with an SPQuery too. That would be much faster than iterating through all users. You could use the
<In>
Tag inside the query to get all users that have not been assigned by a workflow. For this tag check: http://rmanimaran.wordpress.com/2011/03/11/new-in-sharepoint-2010-caml-query/An example on how to exclude items from the page: