London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Page Type save event.

Vote:
 

Hi, 

I'd like to implement some additional CMS auditing to record when any changes are made to a page type by a user within the CMS (Such as adding a new property, or removing an existing property).

I was hoping that there would be an event or something similar that I can hook into but am having trouble identifying anything suitable.

Has anyone accomplished a similar thing?

Thanks.

#194797
Jul 03, 2018 15:00
Vote:
 

Hi

I haven't tested this myself but there two static events on ContentTypeRepository (ContentTypeSaved and ContentTypeDeleted), that I think you should be able to use to handle this scenario.

Regards

Per Gunsarfs

#194800
Jul 03, 2018 15:20
Vote:
 

Hi,

Thanks for your reply. Can confirm the below logic works.

      protected void Application_Start()
        {
            ContentTypeRepository.ContentTypeSaved += (sender,eventArgs) =>
            {
                // Logic here
            };
        }
#194805
Jul 03, 2018 16:02
Vote:
 

Hey Luke,

Just a small side-note. You should rather use an initialization module to subscribe to events. Read more https://world.episerver.com/documentation/developer-guides/CMS/initialization/ 

They will get re-executed in case of an exception + you can add dependencies. A very similar example to yours: https://world.episerver.com/documentation/developer-guides/CMS/initialization/Creating-an-initialization-module/ 

BR,
Marija

#194915
Jul 08, 2018 15:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.