Question

I have a taxonomy field site column that I am deploying via a sandbox solution. I then use the JSOM to hook that taxonomy column up to the appropriate term set in the site collection and to add it to the document library for use

I've then gone in and added some documents and set the metadata for the new field. I've made sure the document is been published and initiate a full crawl. The problem is that after the full crawl I should be seeing a ows_taxid_colname crawled property and a matching mapped property. This isn't happening.

I tried manually creating a metadata column and this works, which leads me to believe that there is something wrong with my field definition. However, it compares other than names to the field that I manually created.

Here is the elements file for my field:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
    ID="{daef5b18-1a73-4bbb-a0e4-acca5ac3885d}"
    Type="Note"
    Name="hermesDocumentTagNote"
    StaticName="hermesDocumentTagNote"
    DisplayName="Document Tag Note"
    Hidden="TRUE"
    CanToggleHidden="TRUE"
    ShowInViewForms="FALSE"
    Required="FALSE"
    Group="Hermes">    
  </Field>
  <Field
       ID="{764728e0-6cc1-4357-8368-4c45ce9f01f2}"
       Name="hermesDocumentTag"
       StaticName="hermesDocumentTag"
       DisplayName="Document Tag"
       Description="This field is used to link pages and related documents together"
       ShowField="Term1033"
       Type="TaxonomyFieldType"
       Required="FALSE"
       EnforceUniqueValues="FALSE"       
       Group="Hermes">
    <Default>
    </Default>
    <Customization>
      <ArrayOfProperty>
        <Property >
          <Name>TextField</Name>
          <Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{daef5b18-1a73-4bbb-a0e4-acca5ac3885d}</Value>
        </Property>
      </ArrayOfProperty>
    </Customization>
  </Field>
</Elements>
Était-ce utile?

La solution

Sometimes SharePoint is a real jerk! It took me more than a few iterations but I figured out a way to make this work. The name and static name properties for the note field need to be set to the ID of the taxonomy field without dashes. Also the ID must not start with a number. Here is an updated field schema that should work.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
    ID="{daef5b18-1a73-4bbb-a0e4-acca5ac3885d}"
    Type="Note"
    Name="bebde866a998469eb957913b889ce44c"
    StaticName="bebde866a998469eb957913b889ce44c"
    DisplayName="hermesDocumentTag_0"
    Hidden="TRUE"
    CanToggleHidden="TRUE"
    ShowInViewForms="FALSE"
    Required="FALSE"
    Group="Hermes">    
  </Field>
  <Field
       ID="{bebde866-a998-469e-b957-913b889ce44c}"
       Name="hermesDocumentTag"
       StaticName="hermesDocumentTag"
       DisplayName="DocumentTag"
       Description="This field is used to link pages and related documents together"
       ShowField="Term1033"
       Type="TaxonomyFieldType"
       Required="FALSE"
       EnforceUniqueValues="FALSE"       
       Group="Hermes">
    <Default>
    </Default>
    <Customization>
      <ArrayOfProperty>
        <Property >
          <Name>TextField</Name>
          <Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{daef5b18-1a73-4bbb-a0e4-acca5ac3885d}</Value>
        </Property>
      </ArrayOfProperty>
    </Customization>
  </Field>
</Elements>

Oh and just an extra tidbit if the display name of your property contains a space you will not be able to get the CSWP to pick up the Page.Property Name when you are building your query.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top