My code worked fine with my previously built (using SP web GUI) custom document library, whereby I would add a document and on the pop-up with the field textboxes, my ItemAdded event would set a taxonomy field from the an item in the termstore.

However, after changing my setup to a one where I programmatically create the content type and fields, the code to set the taxonomy field no longer works.

The SetFieldValue in the following snippet gives an error: "ArgumentOutOfRangeException - The SPListItem being updated was not retrieved with all taxonomy fields"

var listTerms = new List<Term>();
field.SetFieldValue(properties.ListItem, listTerms);

I have checked my elements and schema files and the particular field in question is set to TaxonomyFieldTypeMulti and Mult="TRUE".

When I browse the column via SP Web GUI, it has the "AllowMultipleValues" checked.


So the latest error I get is associated with a missing notefield (as far as I could Google!).

So I tried the following: http://sharepointificate.blogspot.ca/2012/04/deploying-multi-select-managed-metadata.html

And Also: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/310692d3-49f2-4c0f-b911-735f24b769b3/

I modified my schema and element files by adding the notes field for the target MM field and also added the code to attach note id on feature event.

But still I get the same error.


I am using a custom Edit Form for this document library and so maybe I am missing some special markup for the hidden notefield???

Not sure what else to check so any help appreciated.



  • Can you add terms to the field through the UI? Commented Aug 18, 2012 at 21:52
  • Thanks for your reply. The answer is.. no. I get "Failed to get value of the "Tags" column from the "Managed Metadata" field type control. " I can set it to a value via the column settings page but that is obviously no good.
    – Perplexed
    Commented Aug 20, 2012 at 13:37
  • OK seems like your creation of the field fails in some way maybe check Correctly Provisioning Managed Metadata Columns Commented Aug 20, 2012 at 13:49
  • Actually, I need to by-pass some code and test via UI again. I am updating the question with more info.
    – Perplexed
    Commented Aug 20, 2012 at 13:54
  • Ok having followed the link you posted, I now get the error: Invalid field name. {6936f2b0-c0b8-4bb1-909d-63373c1b39d8}. This ID matches that of the TextField in the <Customization> markup.
    – Perplexed
    Commented Aug 20, 2012 at 15:45

1 Answer 1


Ok, the issue was that I did indeed need to add the note fields and also all fields MUST have a name and displayname attribute. This must be done in the elements and the schema files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.