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
|
<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
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.
ReplyDeletehttp://praveenbattula.blogspot.com/2015/02/download-caml-query-designer.html