You created your pages list content types, associated page layouts to those content types, and customers want to use only those content type and page layouts or simply.
Ok, let's assume you have Example 04 deployed (if it's your first time on this blog, download VLibs here), this is what you see in Pages list.

The key to accomplish this task is divide-et-impera, so what about the new page menu?
Work on this property
1 2 3 | IList<SPContentType> contentTypeInstances2Show = ... pagesList.RootFolder.UniqueContentTypeOrder = contentTypeInstances2Show; pagesList.RootFolder.Update(); |
The second step is to make a selection of page layouts available, the method is:
1 2 3 4 5 | PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); PageLayout[] pageLayouts = publishingWeb.GetAvailablePageLayouts(); PageLayout[] pageLayouts2Show = ... publishingWeb.SetAvailablePageLayouts(pageLayouts2Show .ToArray(), false ); |
And this is what we will get
![]() |
New document menu |
![]() |
Available page layouts |
If you need the code, as usual this is the link. Go get it! and have a look at Example 06 ;) .
Sempre un piacere leggere i tuoi articoli... :D
ReplyDeleteIl piacere resta mio. Grazie 1000 XD .
Delete