'Cannot complete this action. Please try again.' when calling SPField.Update() - One solution

I started writing some code for a new SharePoint Feature today and quickly began running into the error:

Cannot complete this action. Please try again.


...on calls to SPList.Update() and SPField.Update(). It appeared to only occur when updating some properties of the SPList and SPField instances and not others.

Most articles I found regarding this error referenced this MS Article. However, that didn't resolve my issue. Neither did setting "AllowUnsafeUpdates" = true on the SPSite and SPWeb objects.

Upon further review of my SharePoint logs, I noticed several instances of the following error message:

Failed to find the parent content type ID="ct-1033-0x01010901004105bb8902fb3f459d93b77e921ce17e" for content type ID="ct-1033-0x01010901004105bb8902fb3f459d93b77e921ce17e00d2c19f98b90dd14eb77883ca6d513d3f"


Turns out, in a separate Feature I had worked on a few days earlier, I had an invalid content type definition (as shown above). I had deactivated this feature in my test site, the content type was no longer in the Site Content Types list, and the test list I was running SPField.Update() against didn't even use this content type. However, for some reason, calls to SPField.Update() (and sometimes SPList.Update()) were still getting blocked by this bad content type. If anyone can explain why, please comment.

I corrected the offending Content Type and everything started working.

0 comments: