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");
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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