Question

My function only works when I'm using my SP_ADMIN user. But when I'm using another user I receive the following error message from the console:

500 (Internal Server Error)

What's wrong with this code?

function addBirthday(List,Name, monthDay, Month, Location) {
    var hoy = new Date();
    var mes = hoy.getMonth();
    mes = mes + 1;

    var query = "<Query><Where><Eq><FieldRef Name='Mes_Nacimiento' /><Value Type='Integer'>"+mes+"</Value></Eq></Where><OrderBy><FieldRef Name='Dia_Nacimiento' Ascending='True' /></OrderBy></Query>";

    var camlViewFields = "<ViewFields><FieldRef Name='"+Name+"' /><FieldRef Name='"+monthDay+"' /><FieldRef Name='"+Month+"' /><FieldRef Name='"+Location+"' /></ViewFields>";

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: List,
        CAMLViewFields: camlViewFields,
        CAMLQuery: query,
        completefunc: function(xData, Status) {

            $(xData.responseXML).SPFilterNode("z:row").each(function() {

                var ItemNombre = $(this).attr("ows_"+Name);
                var ItemDay = $(this).attr("ows_"+monthDay);
                var ItemDayS = ItemDay.toString();
                var ItemMonth = $(this).attr("ows_"+Month);
                var ItemLocation = $(this).attr("ows_"+Location);
                if(ItemDayS.length == 1)
                    ItemDayS = "0" + ItemDayS;

                alert(ItemNombre);

            }); // end completefunc
        }
    }); // end SPServices call
}
Était-ce utile?

La solution

It sounds like the other users don't have read access to the external list. Have you set the object permissions in Central Admin so that all users (or whatever subset) can read the external data?

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top