So if you ONLY have access to the parent GUID in your custom method, you could first retrieve the parent as an IContent item and pass the integer Id into the move signature.
but, as the Move method will then retrieve the IContent object again for the Parent by it's integer Id, it would be much better to have signatures taking in the Guid and/or an IContent item for the Parent when performing this Move...
Umbraco 8 move a node to a parent folder by it's parent folder key (Guid)
Hi,
in Umbraco 8 I want to move a node to a parent folder by it's parent folder key (Guid)
Can I do something like this:
_contentService.Move(orderNode, new Guid(archiveParentId));
It says it needs the integer Id but thought we were moving away from them?
Many thanks
Hi Richard
It looks like the ContentService doesn't have a signature for move that takes the parent GUID 'yet'
https://github.com/umbraco/Umbraco-CMS/blob/d65041c2503fc85ac4619a4abcd703dcc20f067d/src/Umbraco.Core/Services/Implement/ContentService.cs#L1923
(you can see 'Create' has been updated in this file to have both int Id, and Guid signatures).
The 'GetById' method has both signatures:
https://github.com/umbraco/Umbraco-CMS/blob/d65041c2503fc85ac4619a4abcd703dcc20f067d/src/Umbraco.Core/Services/Implement/ContentService.cs#L377
So if you ONLY have access to the parent GUID in your custom method, you could first retrieve the parent as an IContent item and pass the integer Id into the move signature.
but, as the Move method will then retrieve the IContent object again for the Parent by it's integer Id, it would be much better to have signatures taking in the Guid and/or an IContent item for the Parent when performing this Move...
regards
Marc
Thanks Marc
Thats what I went with for now.
I guess I could add this as an application variable as the parent folders should not be deleted.
is working on a reply...