Question

I am attempting to call SPListCollection.EnsureSitePagesLibrary() upon FeatureActivated. The method is throwing the following exception:

Microsoft.SharePoint.SPException: A list, survey, discussion board, or document library with the specified title already exists in this Web site. Please choose another title.

If I check for the list: if (lists.TryGetList("Site Pages") == null) before the call to EnsureSitePagesLibrary(), the method is still executed and the exception is still thrown. Furthermore, when browsing the site through SharePoint Manager 2010, there is no sign of the Site Pages library. Can someone help explain this behavior?

Thanks!

Was it helpful?

Solution

A few possible steps you can try:

  1. Check to ensure your "Wiki Page Home Page" feature is activated.
  2. SharePoint Designer 2010 can create the libraries for you.

    A. Open SharePoint Designer

    B. In the "Site Objects" pane on the left, click "Site Pages". SPD will load the contents of the Site Pages library and tell you it is empty. However, it also creates the Site Pages library for you in the process.

    C. Do the same thing for "Site Assets".

  3. Open your site with SPD and click "All Files" on the left. Check there to determine if the folder or library already exists. If so, that is your problem.

Give those steps a try and let me know if this helps.

EDIT: The original poster did not want the Wiki Page Home Page feature activated so they simply added a library called "Pages". So that works too if you don't want that feature turned on.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top