我正在尝试使用示例中的Trello.NET来查找特定列表中的所有卡片,因为很容易找到板子中的所有列表名称,以及板子中的所有卡片。但是,如果我想要查找特定列表中的所有卡片,就我所能看到的,我需要使用trello.Lists.WithId()来ListID (不能按列表名称过滤)。
知道列表名称,我如何确定它的ListId是什么,以便随后可以过滤其中的所有卡?
如果我随后想要编辑现有的卡,如何确定CardId。
发布于 2013-06-27 04:38:54
使用LINQ并在内存中过滤:
// More than one list can have the exact same name, this finds the first:
var list = trello.Lists
.ForBoard(board)
.FirstOrDefault(list => list.Name == "name of the list");
if (list != null)
{
var cards = trello.Cards.ForList(list);
// ...
}如果知道卡片的名称,您可以使用类似的技术来查找卡片:首先使用trello.Cards.ForBoard或trello.Cards.ForList,然后按名称进行过滤。
不过,对于卡片来说,还有另一个选择:trello.Cards.Search。例如:
var cards = trello.Cards.Search("name of the card");在这种情况下,将在服务器上执行搜索。
https://stackoverflow.com/questions/17327216
复制相似问题