Hi,
I have a file "Sample.txt" in Shared Documents library.
Now, when I upload a file "Test.txt", I need to fetch the properties of "Sample.txt"
and display it in the edit properties page of Test.txt.
On click of Save button, the file "Test.txt" should be uploaded along with properties to the Shared Documents library.
I am trying to achieve this in ItemAdding event. I am able to fetch details of "Sample.txt" and assign it to afterproperties.
But this does not work fine for taxonomy field. Even though it correctly displays the properties of "Sample.txt" in the edit properties page.
On upload, when I edit a taxonomy field and save it.
After upload when verified the updates done to taxonomy field is not maintained.
I am using the below code to update taxonomy fields on ItemAdding event.
string countryValue = sampleItem[field.InternalName].ToString();
TaxonomyFieldValueCollection taxFieldValColl = new TaxonomyFieldValueCollection(sharedDocsLib.Fields.GetFieldByInternalName(field.InternalName));
taxFieldValColl.PopulateFromLabelGuidPairs(countryValue );
properties.AfterProperties[field.Title] = taxFieldValColl.ToString();
"Sample.txt" has both single and multi selection taxonomy fields.
How to assign values to taxonomy field on ItemAdding event?
Thanks in advance,
dhijit