'Uploading file with taxonomy metadata not correctly updated

I'm uploading a file to a sharepoint library but the metadata is not pushed correctly, I get some random taxonomy values in the fields where proper data should be. The metadata I'm pushing is valid and correct.

using(var client = new HttpClient()) {
    using(var form = new MultipartFormDataContent()) {
        Hashtable metadata = new HashTable();
        metadata.Add("vti_title", "File");
        metadata.Add("TaxonomyFieldColumn1", "1033;#TaxNotice|<guid_value_here>");
    
        // other code for binary ..
        
        client.PostAsync(url, form);
    }
}

The interesting thing is, that if I run the same upload on the same file twice, the metadata is always displayed correctly in the 2nd update.

Why this behaviour ?



Solution 1:[1]

Seems it was due to the WSSID. As per my example, "1033;#TaxNotice|<guid_value_here>", 1033 was not the proper WSSID for the term.

What is worth mentioning is that the -1 as WSSID doesn't work, not sure why...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mario