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

When utilizing sites created from custom templates (e.g. OOTB team site with additional library added) and the content included in the template, the following error begins to appear when sites are created from the templates.

System.InvalidOperationException: Operation is not valid due to the current state of the object.   
 at Microsoft.SharePoint.SPListItem.get_EffectiveBasePermissions()    
 at Microsoft.SharePoint.WebPartPages.WikiEditPage.OnPreRender(EventArgs e)    
 at System.Web.UI.Control.PreRenderRecursiveInternal()    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

This will appear on the home page (e.g. Home.aspx) of the sites in question and the page is inaccessible even after all web parts are removed from the page via the Web Parts Maintenance page.

Are there any known issues with utilizing site templates with content that are still unresolved and/or may have been resolved in one of available Cumulative Updates? If there are no known issues, does anyone know of any workarounds (e.g. site features that should not be activated (outside of the publishing feature))?

share|improve this question
    
This error is also coming up in sites without content included. It appears that the home page (Home.aspx of the Site Pages wiki libary does not have a content type associated with it. Other default pages (e.g. How To Use This Library.aspx) have the proper Wiki Page content type applied. Attempting to manage the page properties for Home.aspx from SPD generates a URL similar to siteurl/SitePages/Forms/DispForm.aspx?ID=㼮噁噃敩䁷@㲀ⴭ –  ciphertxt Jun 3 '11 at 15:17
add comment

2 Answers

up vote 2 down vote accepted

This error was occurring on any site template which included a "Site Pages" library on the home page (e.g. Home.aspx). The resolution was to remove the "Site Pages" list view web part from any pages in the template.

See Operation is not valid due to the current state of the object for screenshots.

share|improve this answer
    
What a bizarre problem, thanks for posting your solution –  a25bedc5-3d09-41b8-82fb-ea6c353d75ae Feb 21 '13 at 18:47
    
The link is broken. –  Renan Jan 28 at 14:47
    
Sorry. I migrated my blog. Link has been updated. –  ciphertxt Feb 24 at 3:23
add comment

I have an alternate resolution. The error only seems to occur when the web part is based on the default view "All Pages". I created an alternate view called "All Items" (which was based on "All Pages") and then changed the web part to use that view. I then regenerated the site template which then deployed without issue.

No genius here. It was only by chance that I was doing two templates side by side that in respect to the wiki home page differed only by the view. The one that used the default view produced this error, and the one that used a custom view worked.

share|improve this answer
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.