Error: Index was out of range. Must be non-negative and less than the size of the collection

I was facing this error while editing pages in SharePoint sites, and was not able to figure out what's going wrong ?

But finally figured out the solution after 1 day search

There are few checks you need to do to solve this

  1. Check that page using correct page layout
  2. Check that associated content type with page layout is correct
  3. And most important : If there are some wrong / corrupted page layouts in the site's master page gallery then delete them

Sometimes we can't delete those page layouts using UI, (at least in my case I was not able to do so ) so I written a simple console application to delete them and that's all

I hope this helps someone J

Ebook Download
View all
Learn
View all