I think the user ID you pass to CreateContent ends up being overwritten by the user ID passed to Save or SaveAndPublish (which will both default to -1).
The IContent you get back from CreateContent should have its CreatorId and WriterId properties set to 1, but Save will then update both properties.
Content Service CreateContent method ignoring UserId set.
Hi,
I'm using the IContentService within a custom dashboard element. This dashboard imports data and generates nodes with the ContentService.
Currentl, I have the following two users:
I'm logged in with my personal account but when the content is created I'm assigning the
ImportBot
's UserId to the method as shown here:_contentService.CreateContent(c.NodeName, parent.GetUdi(), "newsItem", 1);
However, it always creates the nodes under my account. Is there anyway to force these nodes to be generated by the
ImportBot
?If you are correct this sounds like a bug and should be reported at:
https://github.com/umbraco/Umbraco-CMS/issues
I think the user ID you pass to
CreateContent
ends up being overwritten by the user ID passed toSave
orSaveAndPublish
(which will both default to -1).The
IContent
you get back fromCreateContent
should have itsCreatorId
andWriterId
properties set to 1, butSave
will then update both properties.Thank you Steve
any solution ? While copies or copying content , creatorID is changed to 0
is working on a reply...