Monday, July 05, 2010

"The local device name is already in use" error when using AddFieldAsXml

I had the following exception thrown at me today when trying to add a site column using AddFieldAsXml method: "The local device name is already in use".
The reason was that my XML contained a field ID - which is what the XML for a field is supposed to have when it is used as an element file in a feature, but not when you are adding the field using code. So - beware!

No comments: