SharePoint: SPFieldCollection.AddFieldAsXml Gotcha


This one caught me out today;

The SPFieldCollection.AddFieldAsXml method has a strange quirk – the field is created using the DisplayName value as the fields internal name (InternalName), instead of using the Name/StaticName value.

See this post for further information and a workaround.

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

2 thoughts on “SharePoint: SPFieldCollection.AddFieldAsXml Gotcha

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