SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, here's the scoop. I have bunch of lists on sub sites that I am rolling up into a list on the parent site. Here is what I have for code:

                            var title = $(this).attr("ows_Title");
                                operation: "UpdateListItems",
                                webURL: "/",
                                async: false,
                                batchCmd: "New",
                                listName: "Initiatives",
                                valuepairs: [["Title", title]],
                                completefunc: function(xData,status){

Problem is that when I execute this script, it always adds a new item, even if the name exists. I tried switching batchCmd to "update" but then if the item doesn't exist it won't add it to the list. Is there something built into SPServices that I could use or do I need to roll my own check?

share|improve this question
up vote 4 down vote accepted

You have to "roll your own check". User GetListItems to see if there is an existing item and then conditionally either add a new item or update the existing one.

share|improve this answer
Thanks Marc, I just threw the titles in an array and then checked the current title to the ones loaded. Thanks Again – Brenton Pierce May 30 '12 at 15:53

You have to roll your own, there isn't anything built in. The closest is a form operation, SPRequireUnique. You'd need to do a GetListItems operation to first see what's in the list, compare it to what you have and either skip it, update it, or add it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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