6

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"?

Waqas Sarwar MVP
  • 57,008
  • 17
  • 43
  • 79
thomius
  • 2,808
  • 8
  • 35
  • 50

1 Answers1

8

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);
context.Load(list);
context.ExecuteQuery();
Console.WriteLine(list.Title);

Note: SharePoint 2010 & 2013 compatible

Vadim Gremyachev
  • 42,498
  • 3
  • 86
  • 167