0

my issue is how i could filter items on my SPView based on query: i tried a query to make a filter based on user unfortunately no result on view, no change happen on the displayed items, i need your hepls please:

         string myquery = "<where><eq><fieldref name='Modifié par' LookupId='TRUE'/> 
                           <value type='int'>" + user.ID + "</value></eq></where>";

                SPView vv = list.Views[viewName];
                vv.Query = myquery;
                vv.DefaultView = true;
                vv.Hidden = false;
                vv.Update();
                list.Update();
                list.ParentWeb.Update();
1

2 Answers 2

0

Try following with your SPQuery object:

<Where><Eq><FieldRef Name='Author'/><Value Type='User'>Karine Bosch</Value></Eq></Where>

or

<Eq><FieldRef Name='AssignedTo' /><Value Type='Integer'><UserID Type='Integer' /></Value></Eq>
0
0

You must use correct CAML syntax (lettering). And also FieldRef Name must contain the StaticName / Internal name of the column, not the display name. Also Integer, not Int:

<Where>
    <Eq>
       <FieldRef Name='Editor' LookupId='True'/> 
       <Value Type='Integer'>" + user.ID + "</Value>
    </Eq>
</Where>
0

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.