Documentation > CMS Template API Library > Asset > SaveContent(Dictionary[String,String])

SaveContent

Saves either the asset's indexer or the content provided in a dictionary to the database as this asset's fields. If any of the values in the fieldsToStore dictionary are null, they will be stored as an empty string.

public System.Void SaveContent(Dictionary[String,String])



Parameters

NameDescriptionType
fieldsToStore

If not null, the fields to store. Otherwise the asset's indexer dictionary will be saved.

Dictionary

Code Example

C#

Sample:

             
               asset["foo"] = "bar";
               asset["Hamlet"] = "Shakespeare";
               asset.SaveContent();
            
               Dictionary<string, string> fields = new Dictionary<string, string>();
               fieldsToStore.Add("foo", "bar");
               fieldsToStore.Add("Hamlet", "Shakespeare");
               asset.SaveContent(fieldsToStore);
             

Connect with Crownpeak