I want to use CAML query to delete elements from a SharePoint list.

Right now it deletes element if they have a specific text in their title:

camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Title\'/>' +
        '<Value Type=\'Text\'>'+statID+'</Value></Eq></Where></Query></View>');

What does one have to add to the camlQuery above when it should delete elements if they have a specific text in a column playerID? (So, the element should have a specific title and a specific playerID)

I tried different things, but can't seem to figure it out. Can someone help me?

  • What is the internal name and data type of your playerID field? – Ganesh Sanap Apr 3 '20 at 12:50

Assuming playerID field is of type Single Line of Text (If data type is different then let me know. I will change query accordingly),

Try your query in below format:

                    <FieldRef Name='Title'/>
                    <Value Type='Text'>statID</Value>
                    <FieldRef Name='playerID'/>
                    <Value Type='Text'>playerID</Value>

Note: You need to use the internal name of your column in place of playerID at the line <FieldRef Name='playerID'/>.

Reference: And Element (Query).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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