1

Here is the following specifics in question. I have the following taxonomy field and its associated Note field. The taxonomy field is defined with a space value in it.

    Taxonomy Field
- InternalName: Job_x0020_Title,
- StaticName:    Job_x0020_Title,
- Type: TaxonomyFieldType,
- ID:fbda96f1-3c1d-4f9d-b44b-488cfd405581,
- DisplayName: Job Title
    Note Field
- InternalName:fbda96f13c1d4f9db44b488cfd405581,
- StaticName:fbda96f13c1d4f9db44b488cfd405581,
- Type: Note,
- ID:5709e70c-b414-4faf-92a5-b41d76099e89,
- DisplayName:Job Title_0

I am using the Copy WebService to attempt to upload a file and simultaneously populate the associated meta data.

FieldInformation info4 = new FieldInformation();
            info4.DisplayName = "Job Title_0";
            info4.InternalName = "fbda96f13c1d4f9db44b488cfd405581";
            info4.Id = new Guid("5709e70c-b414-4faf-92a5-b41d76099e89");
            info4.Type = FieldType.Note;
            info4.Value = "-1;#Software Engineer|3260f113-e34d-43ce-ab3a-27ef4bdcb86c";


        FieldInformation[] info = { info1,info4};
        CopyResult resultTest = new CopyResult();
        CopyResult[] result = { resultTest };

        try
        {
         c.CopyIntoItems(fileName, destinationUrl, info, myBinary, out result);
        }
        catch (Exception ex)
        {

        }

I obtain successful results when the managed metadata columns contain zero spaces. For example, JobTitle works perfectly.

FieldInformation info4 = new FieldInformation();
        info4.DisplayName = "JobTitle";
        info4.InternalName = "JobTitle";
        info4.Id = new Guid("394de33f-0336-4d81-bf80-f533e76d3604");
        info4.Type = FieldType.Note;
        info4.Value = "-1;#Software Engineer|3260f113-e34d-43ce-ab3a-27ef4bdcb86c";

Lastly, I noticed one other discrepancy between the two fields (space and no space). Here is the Taxonomy Field for the field with no space in name.

    Taxonomy Field
- InternalName: JobTitle,
- StaticName: JobTitle,
- Type: TaxonomyFieldType,
- ID: 394de33f-0336-4d81-bf80-f533e76d3604,
- DisplayName: JobTitle
    Note Field
- InternalName: j94de33f03364d81bf80f533e76d3604,
- StaticName: j94de33f03364d81bf80f533e76d3604,
- Type: Note,
- ID: 798b387b-52c9-424c-b449-0ae49106f930,
- DisplayName: JobTitle_0

The ID of the taxonomy field is independent of the associated Note field where the other is not.
In short, I get zero errors when it fails to update the field with a space in its name. It simply just does not update the target field. Any ideas?

  • >I have attempted the following as you mentioned and it did not work as suggested. codeFieldInformation info2 = new FieldInformation(); info2.DisplayName = "Job_x0020_Title"; info2.InternalName = "Job_x0020_Title"; info2.Id = new Guid("fbda96f1-3c1d-4f9d-b44b-488cfd405581"); //info2.Type = FieldType.Note; info2.Value = "Software Engineer|3260f113-e34d-43ce-ab3a-27ef4bdcb86c"; code – vmichael Dec 2 at 18:00 Did you get the solution to this? I'm facing the same issue. – Paulo Fagundes Dec 10 '13 at 14:46
  • No, I do not have a solution at this time. – monkeyjumps Dec 12 '13 at 5:35
1

We ended up using the client object model. where ManagedMetaDataField is a simple domain object. The following worked.

Microsoft.SharePoint.Client.Web web = clientContext.Web;
  Microsoft.SharePoint.Client.List documentLibrary = clientContext.Web.Lists.GetByTitle(documentLibraryName);

  ListItem item = documentLibrary.GetItemById(itemID);

  foreach(ManagedMetaDataField managedMetaDataField in managedMetaDataFields)
  {
    item[managedMetaDataField.RelatedFieldName] = managedMetaDataField.FieldValue;
    item[managedMetaDataField.FieldName] = managedMetaDataField.FieldValue;
  }

  item.Update();
  clientContext.ExecuteQuery();
0

AFAIK you should not set the note field manually - set the corresponding Taxonomy-Field (replace spaces with x0020) - the field handles the rest.

  • I have attempted the following as you mentioned and it did not work as suggested. codeFieldInformation info2 = new FieldInformation(); info2.DisplayName = "Job_x0020_Title"; info2.InternalName = "Job_x0020_Title"; info2.Id = new Guid("fbda96f1-3c1d-4f9d-b44b-488cfd405581"); //info2.Type = FieldType.Note; info2.Value = "Software Engineer|3260f113-e34d-43ce-ab3a-27ef4bdcb86c"; code – monkeyjumps Dec 2 '13 at 18:00
0

I don't know if you have the option of using the OfficialFile.asmx and the SubmitFile option, but with this, the metadata get correctly in place even for field names with white spaces.

0

In my experience with SharePoint 2010, the following values are required to set a taxonomy value through 'FieldInformation':

Type: Set this to 'Note'

DisplayName: This is the display name of the hidden note field, it can be obtained by concatenating the display of the taxonomy column and adding '_0'. So for the OP's example of a taxonomy column named "Job Title", the display name of the note field would be "JobTitle_0"

Id: This is the Id of the hidden note field

Value: The format is ""-1;#term-value|term-id ", so an example would be "-1;#Software Engineer|3260f113-e34d-43ce-ab3a-27ef4bdcb86c"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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