0

Currently creating a SharePoint hosted APP.

I am trying to get image URL from Picture Library (Collection) with Column internal name EncodedAbsUrl using CSOM , I have picture lib Collection but not yet succeed,

    var libraryName ="Image Slider";
    var camlQuery=new SP.CamlQuery();
   camlQuery.set_viewXml="<view><Query><Where><IsNotNull><FieldRefName='EncodedAbsUrl' /></IsNotNull></Where><Query></view>";
    libraryItems = library.getItems(camlQuery);
    var listEnumerator = libraryItems.getEnumerator();
    var currentItem = listEnumerator.get_current();
   //here Not getting **EncodedAbsUrl** column value

        var imagePath=currentItem.get_item("EncodedAbsUrl"); 
        var link=currentItem.get_item("URL");

1 Answer 1

2

You need to load the items and then call executequeryasync. Something like:

clientContext.load(libraryItems, 'Include(EncodedAbsUrl,URL)');
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

Then in the success method, you can get the field values. Check this for more information on how to get list items using JavaScript client object model: https://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx

5
  • I had done same like u said , m getting all values like ID, Title etc but not Getting Image URL Jul 7, 2015 at 9:26
  • make sure that you are using the correct field name. Note that you need to use the internal field name Jul 7, 2015 at 9:45
  • Nadeem , Now Its Working for Me, can u please explain why need to use Include(EncodedAbsUrl,URL) Jul 7, 2015 at 13:03
  • Now i'm Able to get "EncodedAbsUrl" but not custom column "URL" value Jul 7, 2015 at 13:04
  • wishing I could get EncodedAbsUrl for the .NET managed CSOM
    – bkwdesign
    Mar 11, 2016 at 15:42

Your Answer

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

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