2013-11-04 94 views
1

我想要做的就是顯示我的分類學字段的完整路徑....簡單!分類學領域ispartrendered財產

我已將這個XML的小片段添加到我想要應用此屬性的字段中的<ArrayOfProperty>

<Property> 
     <Name>IsPathRendered</Name> 
     <Value xmlns:q7="http://www.w3.org/2001/XMLSchema" p4:type="q7:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">true</Value> 
    </Property> 

該字段的所有設置似乎應用,我通過GUI和SharePoint Mananger檢查,它似乎被應用!

然而,不顯示完整路徑....

當我去到GUI和保存現場所有的工作!?!?!?!

我的問題是爲什麼我必須進入我的部署後,並保存字段,以獲得此設置適用?

回答

1

雖然我也想知道如何在XML中做到這一點,但還有一種替代方法:您可以通過在TaxonomyField實例上設置IsPathRendered屬性來在特性接收器中處理它。

public override void FeatureActivated(SPFeatureReceiverProperties properties) 
    { 
     using (SPSite site = (SPSite)properties.Feature.Parent) 
     { 
      Guid fieldId = new Guid("{YOUR-FIELD'S-GUID-GOES-HERE}"); 
      TaxonomyField field = site.RootWeb.Fields[fieldId] as TaxonomyField; 

      // Render full taxonomy path, not just the leaf. 
      field.IsPathRendered = true; 

      field.Update(); 
     } 
    }