Our users made a bunch of pages in German in the English section of our site, so I'm trying to copy them over to the correct culture - because there are like 500 pages. In the Kentico UI, they can "Create a new culture version" and "copy content from another language". So, the admin itself can do this. On Kentico v12.0.74.
Anyway, I wrote a script, but this only copies the content from the page (text fields) - doesn't copy categories or attachments (kenticoarticle is a TreeNode
). Sometimes this also doesn't copy anything over (including text fields) - haven't figured out why that is.
kenticoarticle.InsertAsNewCultureVersion("de-de");
kenticoarticle.Publish();
So, I found this script in this forum... This works a bit better - it brings over categories, but still doesn't bring attachments.
DocumentHelper.InsertNewCultureVersion(new NewCultureDocumentSettings(kenticoarticle,"de-de")
{
ClearAttachmentFields = false,
CopyAttachments = true,
CopyCategories = true,
});
kenticoarticle.Publish();
How can I bring over attachments AND categories to this new culture version? The relevant fields are configured as follows:
- Attachment 1: Data type=File, Form Control=Direct Uploader
- Attachment 2: Data Type=File, Form Control=Direct Uploader
- Category List: Data Type=Text, Form Control=Multiple Categories Selector