0
とにかくNameValueListフィールドを更新しますか?Sitecore Update NameValueList Programmatically
キーを見つけて、その値をプログラムで更新したいと考えています。 これは私が試したものですが、動作しません。
Sitecore.Data.Fields.NameValueListField data = Model.Rendering.Item.Fields["Name Value List"];
System.Collections.Specialized.NameValueCollection nameValueCollection = data.NameValues;
using (new Sitecore.SecurityModel.SecurityDisabler())
{
Model.Rendering.Item.Editing.BeginEdit();
nameValueCollection.Set("123456", "New Value");
Model.Rendering.Item.Editing.EndEdit();
}
...
もう一度もう一度チェックして動作します。ポーズされたコードは、複雑さを避けるためのサンプルコードです。私はこのコードを本番環境に追加しているわけではありません。 – Jay