ApplicationEvent MediaService.Saved getting user who trigger the event
Hi All,
Was wondering if there's a way I can get back the user who triggered the Save of a media from within the ApplicationEventHandler
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
MediaService.Saved += this.MediaService_Saved;
}
#endregion
private void MediaService_Saved(IMediaService sender, SaveEventArgs<IMedia> e)
{ // inside here to get back the user that trigger the save of the media event
}
Not sure if this is the "proper" way of doing it but I've used this before:
using Umbraco.Web;
private void MediaService_Saved(IMediaService sender, SaveEventArgs<IMedia> e)
{
// fetch the current User
var currentUser = UmbracoContext.Current.Security.CurrentUser;
foreach (var mediaItem in e.SavedEntities)
{
// each media saved.
}
}
ApplicationEvent MediaService.Saved getting user who trigger the event
Hi All,
Was wondering if there's a way I can get back the user who triggered the Save of a media from within the ApplicationEventHandler
thanks
Hi,
Not sure if this is the "proper" way of doing it but I've used this before:
HTH, David
I'll try it out, thanks David
All good David
is working on a reply...