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
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
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();
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
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.