How do I add a record to umbracoUserStartNode table?
Hi there,
I am trying to find a way to add a record to umbracoUserStartNode table. I read through the document around the user and database but could not find anything helpful.
May I ask if there is an existing service that Umbraco provides that I can call directly?
Set the value of the StartContentId, and then use the UserService to Save the updated object, then you should find this alters the value in the database table...
... if I've understood what you are trying to achieve!
Thank you very much, Marc, that's exactly what I am looking for!! Your solution also makes me realized I should start looking at the object model for this kind of requirements.
How do I add a record to umbracoUserStartNode table?
Hi there,
I am trying to find a way to add a record to umbracoUserStartNode table. I read through the document around the user and database but could not find anything helpful.
May I ask if there is an existing service that Umbraco provides that I can call directly?
Kind regards, June
Hi June
The UserService, allows you to 'Save' either a User or UserGroup object.
And both these objects have a property 'StartContentId' that represents the 'StartNode'
https://github.com/umbraco/Umbraco-CMS/blob/34e80d86e8c0b754f6b7a02e307f53cb32806bbe/src/Umbraco.Core/Models/Membership/User.cs
https://github.com/umbraco/Umbraco-CMS/blob/34e80d86e8c0b754f6b7a02e307f53cb32806bbe/src/Umbraco.Core/Models/Membership/UserGroup.cs
So I imagine if you use the UserService to retrieve an existing User or UserGroup object
https://github.com/umbraco/Umbraco-CMS/blob/0bd4dced0b3e9205660114406b7e814f817179c7/src/Umbraco.Core/Services/Implement/UserService.cs
Set the value of the StartContentId, and then use the UserService to Save the updated object, then you should find this alters the value in the database table...
... if I've understood what you are trying to achieve!
regrds
Marc
Thank you very much, Marc, that's exactly what I am looking for!! Your solution also makes me realized I should start looking at the object model for this kind of requirements.
Much appreciated your help!
is working on a reply...