Super old question, but anyone still on 7 that runs into this issue as I just did on an old instance - just explicitly cast your values to string instead of using var. I think when dynamic runs into ints it is not casting them correctly. Simply casting to string to match your property's expected type will allow you to continue to use .SetValue().
IContent does not contain a definition for SetValue when trying to add serialized Json
For some reason, I can't add JSON data serialized to a string in SetValue().
Look at this example:
var newEntries = JsonConvert.SerializeObject(entries).ToString();
var newEntries2 = "{\"Entries\":[{\"Name\":null,\"Phone\":\"123455\",\"Message\":\"Test\",\"Date\":\"2015-05-08T11:47:50.0421163+02:00\"}]}";
property.SetValue("ctaEntries", newEntries);
property.SetValue("ctaEntries", newEntries2);
Line 4 (newEntries2) works, Line 3 doesn't.
I don't get it...
Stumbled on to this problem again, the solution seems to be to write the following in stead:
property.Properties["ctaEntries"].Value = newEntries;
Super old question, but anyone still on 7 that runs into this issue as I just did on an old instance - just explicitly cast your values to string instead of using var. I think when dynamic runs into ints it is not casting them correctly. Simply casting to string to match your property's expected type will allow you to continue to use .SetValue().
Cheers,'
Jamie
is working on a reply...