Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Permanently Mark as Being Edited from code

Vote:
 

Hi!

Does anyone know if it is possible to perform "Permanently Mark as Being Edited" on a page/block from code?

In edit mode this function is located in the Tools menu but I don't know how to activate this from code.

Regards

Erik

#116358
Jan 29, 2015 8:58
Vote:
 

Hi,

Try this:

var inUseRepository = ServiceLocator.Current.GetInstance<EPiServer.Shell.Notification.IInUseNotificationRepository>();

inUseRepository.AddInUseNotification(new InUseNotification
{
    AddedManually = true,
    ContentGuid = myPage.ContentGuid,
    CreateTime = DateTime.Now,
    LanguageBranch = myPage.LanguageBranch,
    Modified = DateTime.Now,
    User = "Hulken"
});
#116373
Jan 29, 2015 10:42
Vote:
 

Thanks Mattias!

That worked perfectly.

/Erik

#116378
Jan 29, 2015 11:10
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.