1%%[/* UPDATE THE HTML CONTENT BLOCK VIA AMPSCRIPT*/]%%
2%%[Set @asset = CreateObject("Asset")]%%
3
4%%[SetObjectProperty(@asset, "ID", 215470); /* Use the Id from the Content block to be modified */]%%
5%%[SetObjectProperty(@asset, "IDSpecified", "true"); /* This is required by the API to denote you are specifying an existing object */]%%
6
7%%[/* Set AssetType (complex property) */]%%
8%%[SET @nameIdReference = CreateObject("NameIdReference")]%%
9%%[SetObjectProperty(@nameIdReference, "Id", 197); /* html block type */ ]%%
10%%[SetObjectProperty(@asset, "AssetType", @nameIdReference)]%%
11
12%%[/* Set Category (complex property) - aka Folder */]%%
13%%[SET @categoryNameIdReference = CreateObject("CategoryNameIdReference")]%%
14%%[SetObjectProperty(@categoryNameIdReference, "Id", 564334) /* Use the Id value of the desired category (folder) */]%%
15%%[SetObjectProperty(@asset, "Category", @categoryNameIdReference)]%%
16
17%%[/* Set Name, Content, and ContentType (simple text properties) */]%%
18%%[SetObjectProperty(@asset,"Name","AMPSCRIPT HTML Content Block")]%%
19%%[SetObjectProperty(@asset,"Content","<div>my UPDATED content</div>")]%%
20%%[SetObjectProperty(@asset, "CustomerKey", "1b147813-4820-4138-bcd2-610493abcb76")]%%
21%%[SetObjectProperty(@asset,"ContentType","text/html")]%%
22
23%%[Set @StatCode = InvokeUpdate(@asset, @StatMessage, @ErrorCode)]%%