Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
    
Please make sure to reply on here and mark answers as the answer that addressed your issue. Otherwise this could lead to other community members not wanting to address your questions. Thanks. –  MAllen22842 Feb 13 '13 at 19:00
1  
I appreciate your input. I ended up taking a different direction since the SPListCollection.EnsureSitePagesLibrary() method simply does not work unless the "Wiki Page Home Page" is activated, which I did not want activated. I ended up using a standard document library called "Pages". If you add this to your answer, I'll mark it as the accepted answer. –  Dylan Berry Feb 14 '13 at 21:00
    
Added it as a foot note to my proposed answer for the other folks who may not want that feature enabled. Glad to hear it is squared away for you. –  MAllen22842 Feb 19 '13 at 18:26
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Checked all 3. The "Wiki Page Home Page" feature is not activated. And I checked with SPD+SPM to ensure that the library was not already created. –  Dylan Berry Jan 16 '13 at 18:42
    
If you activate the "Wiki Page Home Page" feature do you still have the same problem? –  MAllen22842 Jan 17 '13 at 13:24
    
I didn't want the wiki features enabled. –  Dylan Berry Feb 14 '13 at 20:56
1  
The 'Wiki Home Page' feature can be de-activated: the home page change is undone but the SitePages and SiteAssets remain. Also, in my testing the EnsureSitePages/EnsureSiteAssets do work, even without the Wiki feature. What probablyl happens is that your feature deploys to SitePages before the library is there: this will cause a folder to be created with the same name: your files are deployed but the EnsureSitePages will now fail. –  Erik Erkelens Apr 24 '13 at 12:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.