we tried the below code and ended up with an object reference error
private void Events_AfterUpdateContent(ContentAfterUpdateEventArgs e) { try { var content = _contentApi.Get(e.ContentId, e.ContentTypeId); var strHtml = content.HtmlName("Web") + " " + GetContent(content) + " " + Tags(e.ContentId, e.ContentTypeId); if (Checkcontent(e.ContentTypeId)) { bool isAbused = ValidateContent(strHtml); if (isAbused) _abuseController.IdentifyAsAbusive(e.ContentId, e.ContentTypeId); } } catch (Exception) { throw; } }
private string GetContent(Content content) { if(content.ContentTypeId == Apis.Get<IBlogPosts>().ContentTypeId) { var post = Apis.Get<IBlogPosts>().Get(content.ContentId); string body = post.Body("Web"); Apis.Get<IEventLog>().Write("fileurl " + post.File.FileUrl, new EventLogEntryWriteOptions { }); body = body + " <img alt=" " src="" + post.File.FileUrl + "" />"; return body; } return content.HtmlDescription("Web"); }
We are getting object references on the line where we are accessing the code Apis.Get<IEventLog>().Write("fileurl " + post.File.FileUrl, new EventLogEntryWriteOptions { });
we are uploading the post image while creating the blogpost.
we tested this on 11.1.3 and 11.1.5 , still we faced same issues on both the versions.