SharePoint 2010: Values entered in Enterprise Keywords column are not saved for Office 2007 and 2010

Article ID: 2430626 - View products that this article applies to.
Expand all | Collapse all

Symptoms

Create a site column which has two words and a space between these two words through Object Model code. Associate this site column and "Enterprise Keywords" column to a Site Content type. Associate this Content type to a Document library. Upload a 2007 document to the document library and enter values for the Enterprise Keywords column and click Ok. Edit properties of the document and notice that the Enterprise Keywords value is not saved. Values are stored for txt or Office 2003 file types.

Cause

When we create a site column through the Object model and associate the StaticName property of the field with a string which has two words and a space between these two words and set this field as Required you would notice this issue.

Resolution

While assigning the StaticName property of the field ensure that the string doesn't have any spaces between the words.

For Ex: Issue would occur if we create a Site column as given below

SPSite oSite = new SPSite("<SiteURL>");
SPWeb oWeb = oSite.OpenWeb();
oWeb.AllowUnsafeUpdates = true;
SPFieldText retTypeText = new SPFieldText(oWeb.Fields, SPFieldType.Text.ToString(), "Test Column");
objNewField = retTypeText;
if (objNewField != null)
{
objNewField.Title = "Test Column";
objNewField.Required = true;
objNewField.ShowInDisplayForm = true;
objNewField.ShowInEditForm = true;
objNewField.ShowInNewForm = true;
objNewField.ShowInViewForms = true;
objNewField.ShowInListSettings = true;
objNewField.StaticName = "Test Column";
oWeb.Fields.Add(objNewField);
oWeb.Update();
}
oWeb.AllowUnsafeUpdates = false;
oWeb.Dispose();
oSite.Dispose();

To resolve the issue, in above code ensure that the value for ObjNewField.StaticName is set as "TestColumn" instead of "Test Column"

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2430626 - Last Review: October 25, 2010 - Revision: 4.0
APPLIES TO
  • Microsoft SharePoint Foundation 2010
  • Microsoft SharePoint Server 2010
Keywords: 
KB2430626

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com