Saturday 19 April 2014

Site Pages and Site Assets missing in your Newly Created SharePoint Site?

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. 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()

Happy SharePointing!!!:)