0

我正在尝试使用 Trello.NET 在特定列表中查找所有卡片。但是,如果我想查找特定列表中的所有卡片,据我所知,我需要使用 trello.Lists.WithId() 的 ListID(无法按列表名称过滤)

知道列表名称后,我如何确定它的 ListId 是什么,以便随后过滤其中的所有卡片?

如果我随后想编辑现有卡片,我如何确定 CardId。

4

1 回答 1

0

使用 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.ForBoardor trello.Cards.ForList,然后再按名称过滤。

对于卡片,还有另一种选择:trello.Cards.Search. 例如:

var cards = trello.Cards.Search("name of the card");

在这种情况下,搜索将在服务器上执行。

于 2013-06-26T20:38:54.373 回答