How is it possible to get the URL of an image that is stored in a Picture Library using CAML?

Currently, I've made a CAML Query and run it in the U2U CAML Query Builder, and am seeing values like ows_LinkFilename, ows_LinkFilenameNoMenu, and ows_LinkFilename2 -- fields that store the URL of the image. (They contain what I need - image.jpg or image2.gif, etc.) When I implement it and output the value in that field, I get an "Undefined."

Is it even possible to access the URL from just the file itself? Do I need to make one of the required fields in the Picture Library the name of the image? (image.jpg)

Below is a snippet of the jQuery.

var fieldsToRead =     "<ViewFields>" +
                                "<FieldRef Name='ows_LinkFilename' />" +
                                "<FieldRef Name='ID' />" +

        var query = "<Query>" +
                        "<Where>" +
                            "<IsNotNull>" +
                                "<FieldRef Name='ID' />" +
                            "</IsNotNull>" +
                        "</Where>" +
                        "<OrderBy>" +
                        "<FieldRef Name='Display_x0020_Order' Ascending='True' />" +
                        "</OrderBy>" +

                operation: method,
                async: false,
                webURL: rootURL,
                listName: list,
                CAMLViewFields: fieldsToRead,
                  CAMLQuery: query,
                    completefunc: function (xData, Status) {
                        $(xData.responseXML).SPFilterNode("z:row").each(function() {
                            var name = ($(this).attr("ows_LinkFilename"));


Thank you so much for your help.


1 Answer 1


By using "<FieldRef Name='EncodedAbsUrl' />", and then having var url = ($(this).attr("ows_EncodedAbsUrl")); instead of var name = ($(this).attr("ows_LinkFilename"));, it pulls the whole URL of the image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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