SharePoint: Why won’t you let me delete a column? A case of “Cannot complete this action.”

Today I deployed a custom SharePoint column and list definition to our productive systems and added some extra columns to test some functionality. I then wanted to delete them again. Boom: ASP.net Error page. ULS told me: “Cannot complete this action. Please try again.“. Suffice to say: Trying again did not help.

Fired up the all-might Powershell and tried deleting the column from there:

PS C:\swFiles\DualConsult.SharePoint.SecretsList\Scripts> $field.Delete()
Exception calling "Delete" with "0" argument(s): "Cannot complete this action.
Please try again."
At line:1 char:14
+ $field.Delete <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

Nothing obvious turned up in ye grande search engine so I had a look what was different about this list and other lists. Turns out I had created a custom content type for the list and it was the only content type on the list (the standard “item” content type wasn’t part of the definition). Since I had used this pattern before I didn’t suspect anything wrong, but since I was stuck I went ahead and added the “item” content type.

SharePoint 2010 - List Content Types
SharePoint 2010 - List Content Types

Tried deleting the columns again and voila it worked. Interesting side note: Once I removed the “item” content type again, I could delete the second column I had created without any problems as well. SharePoint, you are strange.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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