I have troubles with CAML Query
and GetItems
method from SPList
.
I get a SPList
from web context:
SPList docTypeList = _web.GetList(string.Format("{0}{1}", web.ServerRelativeUrl, "DocumentType"));
The list contains multiple values.
I want to search in it only the value which has a field called DocumentType
with the value "MyValue1". (case sensitive)
I am using the CAML Query:
var queryBuilder = new CAMLQueryBuilder();
queryBuilder.AddComparison("DocumentType", CAMLQueryBuilder.COMPARISON_TYPE.Eq, "MyValue1");
var query = new SPQuery { Query = queryBuilder.GenerateCAML() };
SPListItemCollection queryResultItems = docTypeList.GetItems(query);
In this case it returns as result a record which has the field "DocumentType" having the value "myvalue1", it does not take care about string sensitive.
Is there a possibility to get Items considering sensitive cases?
Thanks for suggestions!
foreach
loop to checkitem["DocumentType"]
against"MyValue1"
(case-sensitive comparision withstring.Equals
).