I have a widget where I am passing in three form field values, and want to widget to update the body text of the event. The parameters passed are...
- Calendar ID
- Event ID
- Body
The problem is that trying to update the event throws an exception on the server (stack trace below).
Here is the code I am using, which gets/converts the params to the required type and then prints out the values for debugging purposed. That line that calls $calendar_v1_events.Update (commented out in this snippet) is the line that causes the exception.
#set($calendarId = $core_v2_utility.ParseInt($core_v2_page.GetFormValue('CalendarId'))) #set($eventId = $core_v2_utility.ParseInt($core_v2_page.GetFormValue('EventId'))) #set($body = $core_v2_page.GetFormValue('Body')) Debugging: [$calendarId], [$eventId], [$body] #set($options = "%{}") $options.Add('Body', $body) #set($event = false) ##set($event = $calendar_v1_events.Update($calendarId, $eventId, $options)) ## ^^^ if I uncomment that line, it throws an exception
As an example, the debugging output for an event I want to update is this...
Debugging: [1], [923], [Test]
My only guess is that maybe the Update method really wants a contentId instead of an Id (for the calendar and/or event), but I'm not sure.
Thoughts?
The exception is...
UnknownException: An error occurred while rendering the scripted widget '_se_update_event_body' (221425a257b34f37a98090903d8abae9) ---> NVelocity.Exception.MethodInvocationException: Invocation of method 'Update' in Telligent.Evolution.Calendar.Plugins.WidgetApi.Implementation.Events threw exception System.NullReferenceException : Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Telligent.Evolution.Calendar.Plugins.WidgetApi.Implementation.Events.Update(Int32 calendarId, Int32 eventId, IDictionary options) --- End of inner exception stack trace --- at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTSetDirective.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Template.Merge(IContext context, TextWriter writer) at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.<>c__DisplayClass26_0.<RenderScriptInternal>b__0() --- End of inner exception stack trace --- at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.<>c__DisplayClass26_0.<RenderScriptInternal>b__0() at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentOutputCachingService.Get(IContentFragment fragment, Control context, String cacheKey, Boolean cacheable, Func`1 getRenderedOutput) at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScriptInternal(ScriptedContentFragment contentFragment, NameValueCollection parameters, String templateName, Control context, Boolean throwExceptions, String cacheKey) at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptableEndpointService.HandleRequest(Guid instanceIdentifier, HttpContext context) at Telligent.Evolution.Rest.Implementation.Resources.Scripting.Scripted.<Register>b__6_0(IRestRequest request, HttpResponse httpResponse)