Append List Items From Any List On SharePoint to A DropDown

May 24, 2012 at 8:21 PM
Edited May 24, 2012 at 9:01 PM

I was recently working on how to access list items from a seperate site collection to a custom form using GetListItems in SPServices. The end result is to use the guid from the list with a few other items to append those items to a dropdown in the custom form.

Here's the code:

        //begin getLists function
        function getList(){
    operation: "GetListItems",
    async: false,
                webURL: "https://spserver/sites/sitecollection2/",  

//enter the guid of the list your are getting items from
    listName: "{e318734a-cfbb-4ad6-9b07-28d08dec7720}",

//enter the guid of a certain view of the list, optional
viewName: "{345F08E7-C05D-4BDD-A88C-691CECE9EEA3}",
                completefunc: function(xData, Status) {
    // alert(xData.responseXML.xml);
                        listTitle = $(this).attr("ows_Title");
                        listItem = "<option></option>" + listTitle + ""

//input the actual id of the dropdown control off of the form

                       // alert(listItem);
        } // end function
    }); // end document ready

May 30, 2012 at 3:32 AM


If you add options to the select that aren't defined in the local list, I expect that you'll get errors on save.


May 30, 2012 at 12:05 PM

That is true. That is how I learned of using the guid in contrast to the actual name of the list.

May 30, 2012 at 8:48 PM

The list name works just as well as the GUID in the Web Services calls. What I meant was that you can't just add arbitrary values to dropdowns and expect SharePoint to allow them in the save (though there are some settings which may allow it).


May 31, 2012 at 1:40 AM

You are correct.