0

My client has multi language SharePoint 2013 environment.I am developing a sharepoint hosted app for my client, but when i try to access any library or list using its name e.g. getByTitle('site pages')...it is giving me an error(List not found) in sites with language other than English. Please suggest me any solution how to access list or libraries in different sites with different languages.

4
  • 1
    you can use "GetList" method and use internal name instead. Commented Dec 29, 2015 at 12:59
  • "GetList" is not available in client side code(javascript). If you able to do it can you please give me any reference link or a complete example. Thanks....@BhaskarDhone
    – Mohit
    Commented Dec 30, 2015 at 7:52
  • ohh My bad , I just missed SharePoint Online. Instead of getByTitle , you can user 'getById(guid);' Let me know if it helps Commented Dec 30, 2015 at 8:03
  • Actually i have to create a single add-in solution for different sites. Different sites will have different GUID for the list with same name. Example 'site pages' library will have different GUID for each site. Thats why i can't use GUID. @BhaskarDhone
    – Mohit
    Commented Dec 30, 2015 at 9:49

1 Answer 1

1

While browsing through other similar Stackexchange questions I found this post containing the exact answer to your question although Microsoft documentation doesn't say anything about it.

var context = SP.ClientContext.get_current();
var list = context.get_web().getList("/sites/dev/Lists/Addresses"); 
context.load(list);
context.executeQueryAsync(function() { 
  alert("loaded!"); 
  }, function() { 
  alert("failed!"); 
});

I've tried the code in my console and I was able to load a list based on the url no matter if I changed the title or not.

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.