Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Emanuel 6 posts 76 karma points
    Feb 01, 2016 @ 13:46
    Emanuel
    0

    Object reference not set to an instance of an object on SaveAndPublishWithStatus

    I am trying to save and publish a new subscriber but i get an error when calling SaveAndPublish. The content is not null, neither ContentService. I am using v7.3.5 but it also happens on v7.3.6. Below is the code and the error

    var contentSubscribers = Services.ContentTypeService.GetContentType("Subscribers"); var content = Services.ContentService.CreateContent(viewModel.Email, contentSubscribers.Id, "Subscriber"); content.SetValue("subscriberEmail", viewModel.Email); content.SetValue("subscriberZipCode", viewModel.ZipCode);

            Services.ContentService.SaveAndPublishWithStatus(content);
    

    [NullReferenceException: Object reference not set to an instance of an object.] Umbraco.Core.Services.ContentService.IsPublishable(IContent content, Boolean checkCurrent) +32 Umbraco.Core.Services.ContentService.IsPublishable(IContent content) +49 Umbraco.Core.Services.ContentService.CheckAndLogIsPublishable(IContent content) +86 Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents) +412 Umbraco.Core.Services.ContentService.Umbraco.Core.Services.IContentServiceOperations.SaveAndPublish(IContent content, Int32 userId, Boolean raiseEvents) +19 Umbraco.Core.Services.ContentService.SaveAndPublishWithStatus(IContent content, Int32 userId, Boolean raiseEvents) +19 PCA.Controllers.NewsletterController.Post(NewsletterViewModel viewModel) in C:\source\PCACore\PCA\Controllers\NewsletterController.cs:27 lambdamethod(Closure , ControllerBase , Object[] ) +103 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker._5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9742689 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

  • Jonathan Ben Avraham 43 posts 216 karma points
    May 20, 2016 @ 14:50
    Jonathan Ben Avraham
    0

    Did you find an answer to this?

Please Sign in or register to post replies

Write your reply to:

Draft