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)
$pubweb.AllowAllPageLayouts($true)
$pubweb.Update();
With no success.
What can I do to fix this? Am I doing something wrong?