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.
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.