Home > Web Services > How to fix “Collection was modified; enumeration operation may not execute. “when using Copy.asmx in SharePoint2010

How to fix “Collection was modified; enumeration operation may not execute. “when using Copy.asmx in SharePoint2010

Problem:

In my current project, we use copy.asmx web services in SharePoint2010 to upload a document to a document library. In one of the document library, when uploading a document with a choice field, it blows up and the error message is Collection was modified; enumeration operation may not execute.

Analysis:

After some research , we found out the problem is that we have 2 content types that both have a field called Document Type , although the internal name are different but the display name are exactly the same and this cause the problem. I am still not too sure why, it could possibly a SharePoint bug.

Solution:

After rename one of the field display name to a different name, it works like a charm. You can download source code with the problem here and source code without the problem here.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: