4

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))?

1
  • 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, 2011 at 15:17

2 Answers 2

3

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.

3
  • What a bizarre problem, thanks for posting your solution
    – Steven
    Feb 21, 2013 at 18:47
  • The link is broken.
    – Geeky Guy
    Jan 28, 2014 at 14:47
  • Sorry. I migrated my blog. Link has been updated.
    – ciphertxt
    Feb 24, 2014 at 3:23
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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