Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Monday, June 24, 2013

Query a workflow status using caml query:


Recently I have got a requirement like need to display the list of items which are all having the workflow status is “In Progress”.
I used caml query to filter the date based on workflow status: “In Progress” like below:
<Query>
       <Where>
                  <Neq>
                          <FieldRef Name="MyWorkflowStatusName" />
                          <Value Type="WorkflowStatus">In Progress</Value>
                 </Neq>
         </Where>
</Query>



But got the “value does not fall within the expect range error”: I have checked the entire fields with both internal names and display names everything defined well but still getting same exception.
After goggling it I came to know that field with value type “WorkflowStatus” should have some predefined integer value types like below.

Status
Value


Not Started
0


Failed on Start
1


In Progress
2


Error Occurred
3


Canceled
4


Completed
5


Failed on Start (retrying)
6


Error Occurred (retrying)
7


Approved
16

   
Rejected
17

I wrote the query like below:
<Query>
       <Where>
                  <Neq>
                          <FieldRef Name="MyWorkflowStatusName" />
                          <Value Type="WorkflowStatus">2</Value>
                 </Neq>
         </Where>
</Query>

Yahooooooo.. I got the expected results…
Conclusion: Please refer the above table while filtering the data based on field with data type:WorkflowStatus
http://social.technet.microsoft.com/Forums/en-US/1b3a0ffc-e8ac-4238-b9d6-458057d735ca/unable-to-query-a-workflow-status-using-caml

1 comment:

  1. I have recently created CAML Query designer based on my own requirements and I am giving that as an utility for free. Hope this will help SharePoint developers in better way.

    http://praveenbattula.blogspot.com/2015/02/download-caml-query-designer.html

    ReplyDelete