Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Boman 6 posts 27 karma points
    Sep 09, 2021 @ 08:45
    Jonas Boman
    0

    Setting CreatorId then copying a page

    Hi.

    When copying a page I raise a Copied-event which is looking on the document type. If it matches a specific type if should set the CreatorId to the logged in user. I seems at the moment the CreatorId is always set to the root user (e g ID: 0).

        private void ContentService_Copied(IContentService sender, CopyEventArgs<IContent> e)
        {
            var item = e.Copy;
            var original = e.Original;
    
            if (item == null || original == null || item.ContentType.Alias != "myDocTypeAlias") return;
    
            item.CreatorId = original.CreatorId; // This does not set the CreatorId
        }
    

    How would I go about to making the change in Creator field stick?

    using cms version 7.5.4

    Edit: see that same question is asked here: https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/57287-How-to-set-the-creator-or-writer-of-a-content-item-in-a-controller-action#comment-325917

Please Sign in or register to post replies

Write your reply to:

Draft