Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Jonathan L Folland 22 posts 114 karma points
    27 days ago
    Jonathan L Folland

    Specify key (guid) when creating content and media items

    I would like to know if it is possible to specify an item's key when creating the item programmatically; or less preferred, change its key after creation.

    I would like to do this for data import feeds where I have a source with keys. In this manner, future updates from the source can look for the item using a direct look up on a key versus index search.

    I would like to be able to do this with both content and media items. Is this possible?

  • Huw Reddick 1659 posts 5776 karma points MVP c-trib
    27 days ago
    Huw Reddick

    I've not attempted this, but according to intelisense Key has a setter, so you could maybe try

                    var post = _contentService.Create(postName, parent, "forumPost");
                    post.Key = Guid.Parse(YOUR GUID);
  • Jonathan L Folland 22 posts 114 karma points
    17 days ago
    Jonathan L Folland

    I can confirm this works. For some reason, it just did not even think I could just set the property and save. Thank you.

Please Sign in or register to post replies

Write your reply to: