SymptomsOffice 365 tasks fail and the "Operation is not valid due to the current state of the object" error message appears in the task logs.
CauseOn the IIS web server running the Office 365 Gateway Application the maximum number of form keys, files, and JSON members is limited to 1000 in an HTTP request. See http://support.microsoft.com/kb/2661403 for details.
ResolutionIncrease the corresponding limits:
1. Log on to the IIS web server running the Office 365 Gateway Application.
2. Open the settings.config file of the Office 365 Gateway Application in a text editor.
3. Add the following entries to the file after the <appSettings> entry:
<add key="aspnet:MaxHttpCollectionKeys" value="20000" />
<add key="aspnet:MaxJsonDeserializerMembers" value="20000" />
4. Save the file.
5. Restart IIS.