Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

So, you want to migrate some documents that have managed metadata columns from another source into SharePoint Online.

Microsoft.SharePoint.Taxonomy is blocked.

Microsoft.SharePoint.Client.Taxonomy is 2013 only?

...and other remote ways are blocked for various reasons.

I was thinking possibly something like:

item["Country"] = "-1;#" + strCountryTag;
item["f80750f091f94eed8a5edc234d010620"] = getTermWithGuid(strCountryTag, "Country");
item.Update();

Like you would with the client object model, but this doesn't work like this. (-1 is because the taxonomy hidden list is empty so I don't need to look up WSSIDs)

Does anyone know of something that will make the code work in the example, so you can use Managed Metadata fields like you would a standard 2010 installation just with a custom bit of code?

Please presume that all the term guids are accessible at this point.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The Country column has to be updated in this form: <WssId>;#<Label>|<TermGuid> and the linked, hidden text field has to be updated with <Label>|<TermGuid>

<WssId> should be an index in the TaxonomyHiddenList if the term exists in that list, but passing -1 seems to work too.

This works on the SP2013 version of Office365, and on-premise SP2010 and SP2013.

This MSDN blog has more details.

share|improve this answer
    
That didn't work. Also getTermWithGuid does format it correctly. But it still won't update regardless. –  Hugh Wood Dec 6 '12 at 9:31
    
Could you please double check that you have the right Guid? Do this by starting fiddler and editing the properties of an item with a taxonomy column. When you type and the term the autocompletion has found a term, look at the last call to /_vti_bin/TaxonomyInternalService.json/GetSuggestions. Open the JSON tab and look at d.Groups.Suggestions and verify that your DefaultLabel and Id match the ones you use in getTermWithGuid(). Is this SP2010? –  Erik Erkelens Dec 6 '12 at 11:30
    
Yes, all the guids are correct. and there is an easier way, request a document in office and look at the cached xml folder, it stores the metadata locally for you. It just doesn't update the field when trying to enter the data as you suggested or any other way I tried. –  Hugh Wood Dec 6 '12 at 11:34
    
But you did give myself an idea just now. If office can update the Managed Metadata I can just rip it's method off with fiddler2 :) sending you 10pt for reminding me about fiddler, I was going to run it on a migration tool and see how it did it, but there is no need. Office does it. –  Hugh Wood Dec 6 '12 at 11:57
    
Thanks. But, you're right, I can't get it to work on Office365 either. (the developer preview - based on SP2013; are you using the 2010 version of Office365?). It does work on the on-prem versions of 2010 and 2013. While trying this out I also noticed you don't have to provide the -1;# (WssId). –  Erik Erkelens Dec 6 '12 at 16:18
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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