+1-888-365-2779
Try Now
More in this section

Forums / Suggestions / Lists & List Items

Lists & List Items

7 posts, 0 answered
  1. Stuart Hemming
    Stuart Hemming avatar
    144 posts
    Registered:
    07 Jul 2004
    28 May 2011
    Link to this post
    The List Item manager could really use to option to move from one list to another.

    -- 
    Stuart
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    31 May 2011
    Link to this post
    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
  3. Stuart Hemming
    Stuart Hemming avatar
    144 posts
    Registered:
    07 Jul 2004
    31 May 2011
    Link to this post
    Hi Stanislav,

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

    -- 
    Stuart
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    02 Jun 2011
    Link to this post
    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
  5. Thomas
    Thomas avatar
    223 posts
    Registered:
    19 Jan 2011
    16 Apr 2012
    Link to this post
    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.
  6. Thomas
    Thomas avatar
    223 posts
    Registered:
    19 Jan 2011
    19 Apr 2012
    Link to this post
    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());
  7. Salman
    Salman avatar
    1 posts
    Registered:
    26 Apr 2012
    26 Apr 2012
    Link to this post
    That's a great setting moving list to another. I've heard that before but never been try.
7 posts, 0 answered