Saturday 31 March 2012

Error on Create Page\Publish Page - "Index was out of range. Must be non-negative and less than the size of the collection" in SharePoint

Last week I moved a site from one database to other using one of tools our company uses. The new site looked great except it got few bugs that didn't exist in the old site (when site was at old db i should say). One of the most irritating bug was an error message "Index was out of range. Must be non-negative and less than the size of the collection" in SharePoint" that i got when i clicked Create New Page, site templates and layouts in Site settings) and when i tried to publish an existing page.

Well the main cause of error was soon found by one of my colleagues and it was our very own "Custom layout page" in Master page gallery. Initially all the layouts in Master Page gallery looked the same so to find out the bugy layout we added "Associated Content Type" field in our existing view. The value for for Associated Content Type for this broken layout was #VALUE! well that was a good hint.

After knowing the issue we did tried to fix the associated content type but since we were not able to even get to the layouts page's properties, we decided to just remove the layout page and migrate it manually.

Of course all the existing pages needs to be upgraded with this new layout and that you can do in content and structure of your site.

No comments:

Post a Comment