Nodes entered programmatically get error "No user ...
# help-with-umbraco
b
Hello, I insert some data via API Controller to my 14.2 Umbraco site, save it in a new v14 way: // Save the changes _contentService.Save(post); // Publish the content var publishResult = _contentService.Publish(post, new[] { "*" }, 0); I only have one language. So, it's inserted, and on list collection of nodes, my name is displayed as "Updated by". When I open the new post, everything looks fine, but on Info tab I get error (image). Changing or publishing such post on UI is slow or doesn't publish at all with errors. https://cdn.discordapp.com/attachments/1288155178377154671/1288155179023204352/image.png?ex=66f4277f&is=66f2d5ff&hm=a0010be04bb24e429c1a34270224359098304844a3e3e13e4518f0627ed405c8& https://cdn.discordapp.com/attachments/1288155178377154671/1288155179744759881/message.txt?ex=66f4277f&is=66f2d5ff&hm=bae8ea2995322449c1e256e69aa51563b95f95162966981736d4d8ad5d798863&
m
_contentService.Publish(post, new[] { "*" }, -1);
maybe? where -1 is the SuperAdmin?
Looking in the UmbracoUsers table.. doens't look like you get a user with id=0... -1 being superadmin, and 1 the first added user.. https://cdn.discordapp.com/attachments/1288155178377154671/1288157917131964417/image.png?ex=66f42a0c&is=66f2d88c&hm=c137461a87e65004c53fbdfbe037706f2d7242f717cb8d0ec4db2168c0a819bd&
k
But you are not passing
-1
to
Publish()
. You are passing
0
b
@kdx-perbol yes you are right, dumb me. But I do get -1 on all nodes entered? I have like hundreds of them. Maybe 0 is set somewhere else? https://cdn.discordapp.com/attachments/1288155178377154671/1288390811591118891/image.png?ex=66f502f2&is=66f3b172&hm=f5e84428a5e824737305239780f770e41cd17ef08bc6403bef5d15dfd9dfe3f8&
k
Not sure what
umbracoNode.nodeUser
means. The database for a "content item" afaik has nodes, documents, versions, language versions, and I think all these could have different user IDs. Iirc the node is the top-level umbrella for an item in the content tree. So yes, 0 could be set as the "published by" on a "document version" or similar. Do you get the error when passing
-1
to
Publish()
?
b
I deleted all nodes and reentered them. Looks good.
6 Views