The problem:
I am creating a site from my site collection feature receiver; the site is not a team site, but it does need to have the Site Pages library. You might recall that on every team site this library is automatically provisioned, because of the WikiPageHomePage feature; however, the problem is that this feature cannot be activated in non-team sites.
The solution:
Since I have to activate the feature in code, the best way to do it is to obtain the reference to the site that is being created and then call the EnsureSitePagesLibrary():
SPWeb web = ...
SPList list = web.Lists.EnsureSitePagesLibrary();
Note that, in a similar fashion, you can provision a Site Assets library in a non-team site - just call EnsureSiteAssetsLibrary(), rather than EnsureSitePagesLibrary().
No comments:
Post a Comment