Love the Grid Data type - does exactly what I need :) I'm trying to import content into Umbraco using the Web API and I'm struggling to set the Grid Data Type properly. I've tried an object but its failed. Code below is what I'm using. Any advice??
IContent venue;
venue = contentService.GetById(venueId);
var special = new Special();
special.featureBeer = beer;
special.isMonday = monday;
special.summary = summary;
venue.SetValue("specials", special);
contentService.SaveAndPublish(venue);
Error:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'Umbraco.Core.Models.ContentBase.SetPropertyValue(string, string)' has some invalid arguments at CallSite.Target(Closure , CallSite , Object , String , Object ) at Umbraco.Core.Models.ContentBase.SetValue(String propertyTypeAlias, Object value)
haveyou tried serializing to JSON before inserting? also I think it will have to be a List<Special> as this datatype allows a list of values to be used.
Using the Web API
Hi All!
Love the Grid Data type - does exactly what I need :) I'm trying to import content into Umbraco using the Web API and I'm struggling to set the Grid Data Type properly. I've tried an object but its failed. Code below is what I'm using. Any advice??
Error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'Umbraco.Core.Models.ContentBase.SetPropertyValue(string, string)' has some invalid arguments at CallSite.Target(Closure , CallSite , Object , String , Object ) at Umbraco.Core.Models.ContentBase.SetValue(String propertyTypeAlias, Object value)
Any advice/help would be greatly appreciated :)
haveyou tried serializing to JSON before inserting? also I think it will have to be a List<Special> as this datatype allows a list of values to be used.
Thanks Stephen - I ended up attaching a debugger and seeing the JSON, so manage to use that and it worked a treat :)
Cheers!
is working on a reply...