Skip to content

GetCardsOnBoardAsync

Rasmus Wulff Jensen edited this page Jan 26, 2025 · 8 revisions

Back to Card Features

Get all open cards on un-archived lists on a board

Tip: If you need both Normal + Archived or only Archive cards then use the options.Filter

Signature

/// <summary>
/// Get all cards (default only all un-archived lists on a board; use options.Filter to get archived cards)
/// </summary>
/// <param name="boardId">Id of the Board (in its long or short version)</param>
/// <param name="options">Options on how and what should be included on the cards (Example only a few fields to increase performance or more nested data to avoid more API calls)</param>
/// <param name="cancellationToken">CancellationToken</param>
/// <returns>List of Cards</returns>
public async Task<List<Card>> GetCardsOnBoardAsync(string boardId, GetCardOptions options, CancellationToken cancellationToken = default)

Examples

string boardId = "63c939a5cea0cb006dc9e88b";

//Get Cards on board with default return values
List<Card> cardsOnBoardAsync = await _trelloClient.GetCardsOnBoardAsync(boardId);

//Get Cards on board, but just the Name and StartDate (for better performance) of the Card + Full List instead of just it's Id so you do not need a secondary method call
List<Card> cardsOnBoardAsync = await _trelloClient.GetCardsOnBoardAsync(boardId, new GetCardOptions
{
  CardFields = new CardFields(CardFieldsType.Name, CardFieldsType.Start),
  IncludeList = true
});

//Get Archived Cards
List<Card> archivedCardsOnBoardAsync = await _trelloClient.GetCardsOnBoardAsync(boardId, new GetCardOptions 
{
   Filter = CardsFilter.Closed
});

Clone this wiki locally