Lists & List Items - Ideas & Feature Requests - Ideas & Feature Requests - Progress Community
 Ideas & Feature Requests

Lists & List Items

  • Lists & List Items
  • The List Item manager could really use to option to move from one list to another.

    -- 
    Stuart
  • Hello Stuart,

    Excuse me for the question, do you mean that List items should be moved from one list to another?

    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi Stanislav,

    Yes, that's what I'm talking about.

    -- 
    Stuart
  • Hi Stuart,

    We appreciate your suggestion and I have logged it as a feature request. The team will discuss it and take actions.

    Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi,

    Meanwhile, is there a way to do it through the API? If so, how?
    I tried this, but it doesn't work (the parent is null in the DB):

    var lm = ListsManager.GetManager();
     
    // Get list item
     
    var listItemTemp = lm.Lifecycle.CheckOut(listItem) as ListItem;
    var parentId = App.WorkWith().Lists().Where(l => l.Title == listName).Get().Single().Id;
    listItemTemp.Parent = lm.GetList(parentId);
     
    var listItemMaster = lm.Lifecycle.CheckIn(listItemTemp) as ListItem;
    lm.Lifecycle.CheckIn(listItemTemp);
    lm.Lifecycle.PublishWithSpecificDate(listItemMaster, listItem.PublicationDate, Thread.CurrentThread.CurrentCulture);
     
    lm.SaveChanges();

    I also tried doing oldList.ListItems.Remove(item) then newList.ListItems.Add(item), but this doesn't work either. It removes the item from the old list, but doesn't add it to the new list. Same thing if you call Add without calling Remove first.

    Thanks.
  • Hi again,

    I still couldn't find a solution. I thought of another way to do it: create new list items from scratch, and manually copy all their properties. This works, except for taxonomy associations, which I can't manage to copy.

    var listItemClone = lm.CreateListItem();
    listItemClone.Title = listItem.Title;
    listItemClone.Content = listItem.Content;
    listItemClone.Owner = listItem.Owner;
    listItemClone.LastModifiedBy = listItem.LastModifiedBy;
    listItemClone.SetValue("Category", listItem.GetValue("Category")); // does not work

    Can anyone help? Thanks.

    Edit: I found out this works to set the taxa of a list item:
    listItemClone.Organizer.AddTaxa("Category", listItem.GetValue<TrackedList<Guid>>("Category").ToArray());
  • That's a great setting moving list to another. I've heard that before but never been try.