This project has moved and is read-only. For the latest updates, please go here.

GetListItems gets items from recycle bin

May 30, 2014 at 10:21 AM
Hi everyone,

recently I've noticed that GetListItems gets all items from the list, including removed ones. It is espessially annoing when you need to compare existing items with the new one. Have anyone noticed the issue? If yes - how can it be resolved? (some additions in the CAML query, maybe?)

here is my code, just in case:
function verifyDatesOverlap(startDate, endDate)
    var currentRequestId = getURLParameter('ID');
    var employee = $().SPServices.SPGetCurrentUser({fieldName: 'Title',});
    startDate = startDate.substring(6,10) + "." + startDate.substring(3,5)+ "." + startDate.substring(0,2);
    endDate = endDate.substring(6,10) + "." + endDate.substring(3,5)+ "." + endDate.substring(0,2);
    //var date1 = startDate + "T12:00:00Z"; //yyyy-mm-dd
    var myQuery = "<Query><Where>"+
                                    "<FieldRef Name='Requestor' /><Value Type='text'>"+ employee +"</Value>"+
                                       "<FieldRef Name='StartDate'/>"+
                                       "<FieldRef Name='_EndDate'/>"+
                                       "<Value Type='DateTime'><Year /></Value>"+
        var isOverlap = false;
            operation: "GetListItems",
            async: false,
            listName: "Vacations",
            CAMLViewFields: "<ViewFields>"+
                                "<FieldRef Name='ID' />"+
                                "<FieldRef Name='Title' />"+
                                "<FieldRef Name='_EndDate' />"+
                                "<FieldRef Name='StartDate' />"+                        
            CAMLQuery: myQuery,
            completefunc: function (xData, Status) {
                $(xData.responseXML).SPFilterNode("z:row").each(function() {                    
                    var id = $(this).attr("ows_ID");

                    var endDate1 = $(this).attr("ows__EndDate");
                        endDate1 = endDate1.substring(0,10).replace("-", ".").replace("-", ".");
                    var startDate1 = $(this).attr("ows_StartDate");
                        startDate1 = startDate1.substring(0,10).replace("-", ".").replace("-", ".");
                    if(startDate <= endDate1 && startDate1 <= endDate && currentRequestId != id)
                        isOverlap = true;
                }); //each inside complete function      
            } //complete function
        }); //spservices
    return isOverlap ;
P.S. I realize this is not the best piece of code, but this is not the question right now :)

May 30, 2014 at 12:56 PM
I have been developing with SPServices extensively for 3 years now and I'm certain that has never happened to me or any of my users. Once an item is deleted from a list and moved to the Recycle Bin, it is not accessible by GetListItems or any other web service call that I'm aware of. When you say "even the removed ones", have you verified those items are actually in the recycle bin at the time the web service is called? Is it possible you have duplicate records?

May 30, 2014 at 6:12 PM
I'm with Geoff on this. Deleted items are no longer in the list and cannot be retrieved.

May 30, 2014 at 9:34 PM
Thanks for your replies,

I am 100% certain the item was removed to the recycle bin, also, after removing it from there - issue was resolved (i.e. it was no longer returned).
However, I've linked this 2 events and not sure one caused another :)
I will check one more time and reply with the results.

May 31, 2014 at 9:45 PM

I think you'll find that you've misinterpreted something, but please let us know what you find out!