1

I want to extend /sitecore/api/ssc/EXM/Message endpoint with additional data.

I added a new class

namespace Exm.Extended
{
    [ServicesController("EXM.Message")]
    public class MessageController : Sitecore.EmailCampaign.Server.Controllers.Message.MessageController
    {
        //

        //private ParentController _parent;
        public MessageController(
            ItemUtilExt itemUtil,
            ILanguageRepository languageRepository,
            IMessageVariantsService messageVariantsService,
            ILogger logger,
            IExmCampaignService exmCampaignService)

            : base(itemUtil, languageRepository, messageVariantsService, logger, exmCampaignService)
        {
           
        }

       
        [ActionName("DefaultAction")]
        public new Response Message( MessageContext data )
        {
            MessageResponse response = (MessageResponse) base.Message(data);
           //todo change/extend response
            return response;
        }
    }
}

I added a custom DI configurator

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <services>
      <configurator type="EXM.Custom.Configurator, My.Website"/>
...

and Replaced the default EXM MessageController with my custom one

 public void Configure(IServiceCollection serviceCollection)
 {
container.Replace(ServiceDescriptor.Transient(typeof(Sitecore.EmailCampaign.Server.Controllers.Message.MessageController), typeof(Exm.Extended.MessageController)));
..

if I debug now, the custom.messagehandler constructor is hit, but the new default action does never run => still always the Sitecore.EmailCampaign.Server.Controllers.Message.MessageController.Message action.

0

You can take a look at my answer of my question at Is there any way to update the response of a controller action by pipeline process?

It's taken my couple of days to find out this way

Hope it can help

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.