I have a problem with the PublishingWeb.GetAvailablePageLayouts method.

When I call it, it misses a couple of layouts I have deployed in my style library folder.

Let me explain:

I have a feature that deploys 10 page layouts. 8 of them works, 2 of them not. They are all published with no limitation at all.

I'm using a super user, so it could not be a permission problem.

If I go to the deployment folder, I can find them deployed, all 10 of them. This is my "test" code:

 SPSecurity.RunWithElevatedPrivileges(() =>
              using (SPSite site = new SPSite("http://URL/"))
                  using (var web = site.OpenWeb())
                      PublishingWeb pw = PublishingWeb.GetPublishingWeb(web);

                      foreach(var t in pw.GetAvailablePageLayouts())
                          Console.WriteLine(t.Name + " ->  " + t.ListItem.File.Name);

the Result give me 8 out of 10 result.

I tried also via powershell:

 $web = Get-SPWeb("http://URL")
 $pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)

With no success.

What can I do to fix this? Am I doing something wrong?

  • If you go to Site Settings -> Under Look and Feel -> Page layouts and site templates.. do you see your page layouts here, either on left box or the right box? If not, than SharePoint is not considering them as Page Layouts.. Oct 15, 2014 at 20:56
  • There I can see only 8 out of 10 pages.. How can I say to sharepoint my pages are layout? I already used the same pages on other machines without any problem!
    – Ziba Leah
    Oct 15, 2014 at 23:33
  • What does the elements file look like for these 2 items? If you compare them to the successfully deployed layout pages, are there any differences? Oct 16, 2014 at 1:13

1 Answer 1


I found out where the problem was:

during the deployment the CONTENT TYPE of the layouts was changed from PAGE LAYOUT to file.

Changing that, the page layout appears again into the available page template.

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.