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);
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);
[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, IDictionary
2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 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.WrappedAsyncResultBase
1.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) +155Did you find an answer to this?
is working on a reply...