Friday, August 14, 2015

Missing Site Pages and Site Assets libraries in SharePoint 2010

Ever wonder why sometimes when you create a site in SharePoint 2010, 
the Site Pages and Site Assets libraries are not created, yet other times,
 they are?

The answer lies in a feature called Wiki Page Home Page,
 which is enabled by default for Team Sites in SharePoint 2010.
 However, other types of site templates may not activate that feature by default, 
and if that’s the case, those libraries won’t be there.

If you need them, you have a few options:

Activate the “Wiki Page Home Page” feature. The feature will create 
those libraries and will also create a wiki page and set it as the 
home (welcome) page for your site.
If you only need the libraries and don’t want your home page changed,
 you can have SharePoint Designer 2010 create the libraries for you:
Open SharePoint Designer.
In the “Site Objects” pane on the left, click “Site Pages.” SP Designer
 will load the contents of the Site Pages library and tell you it’s empty.
 However, it also creates the Site Pages library for you in the process.
Do the same thing for “Site Assets” (also in the Site Objects pane).
If you have code that depends on the existence of these libraries 
(such as a feature receiver), you can use two methods on the SPListCollection 

class to ensure the libraries are there:
EnsureSitePagesLibrary()
EnsureSiteAssetsLibrary()

No comments:

Post a Comment

Google+ Followers