2013-02-13 24 views
0

我應該循環遍歷所有組件並更改某些字段的內容。一切都很順利,直到我遇到嵌入式文件。我不知道如何從嵌入字段獲取值,檢查嵌入的字段類型,更改值和保存。 我可以通過使用TOM.NET API訪問嵌入字段,但在這種情況下,我無法保存我的組件。 如果我理解得很好,TOM.NET API是「只讀」 - 不允許更改。Tridion:更改組件的嵌入式字段值

請幫忙! 謝謝, Milos

回答

0

我找到了解決方案。這是代碼的和平通過所有嵌入字段循環:

public void loopFileds(ItemField field) 
if(field.FieldType.Equals(Tridion.ContentManager.Interop.TDSDefines.EnumTridionWebSchemaFieldType.FieldTypeEmbed)) 
      { 
      ItemFields embeddedFileds = field.value[1] as ItemFields; 
      if (embeddedFileds != null) 
       { 
       foreach (ItemField item in embeddedFileds) 
        { 
         // recursive call to pass through all embedded fields with the custom depth 
         loopFileds(item); 
        } 
       } 

      }