I have a list item that gets triggered daily to send a workflow task.

I created a web part to search based on different column values of the list item and the tasks.


  1. It goes through the items in the list and select those that meet the search parameters
  2. It retrieves all the workflow associated to that item
  3. It retrieves all the tasks associated to that workflow
  4. It will then compare to see if the the search values selected for the task meet the search value retrieved
  5. Display the results (Includes information from the main list item, tasks list as well as listGUID and workflow instance GUID from the workflows) - It requires all of this information in the results.

This process is time consuming. Trying to implement another approach, by using SPQuery on the lists and then combining the results in a data table view.

I am interested in using the SPQuery to retrieve the information and possibly reduce the time it takes display those results. I am thinking of using SPQuery to query the main list, the tasks list and whichever list the workflow information is located.

I would like to know where the workflow information is located and how it is associated to the tasks list. Or any other approach to reduce the amount of time it takes to retrieve the information needed.

1 Answer 1


Utilizing SharePoint Search will be the best approach. One issue you need to take care in that case is finding the relation ship between the Workflow Task against the List Item.

You can use SPQuery to pass the CAML query. In this query you can specify the fields you want to retrieve along with additional filtering parameters. Hence it performs better compared to traditional reading all items from the list. To further improve the performance you can pass the search criteria and get only the relevant list items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.