How to get master page gallery via CSOM so that we would support language packs / we cannot use Lists.GetByTitle("Master Page Gallery").

So how to get list "_catalogs/masterpage"?


How to get Master Page gallery via Managed CSOM

Use Site.GetCatalog method with ListTemplateType.MasterPageCatalog to retrieve Master Page gallery:

var list = context.Site.GetCatalog((int)ListTemplateType.MasterPageCatalog);

Note: SharePoint 2010 & 2013 compatible

| improve this answer | |
  • 1
    Nice, didn't know about that method (deleted my answer) – eirikb Apr 17 '14 at 9:43
  • 3
    And then of course /_api/Web/GetCatalog(116) will work as well – eirikb Apr 17 '14 at 9:45
  • 1
    Good.. We could also use Web.GetCatalog for non-publishing and Site.GetCatalog for publishing site collections etc. – thomius Apr 17 '14 at 12:31

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.