Skip to content
Rasmus Wulff Jensen edited this page Jun 7, 2023 · 8 revisions

Back to Card Features

Update a Card

Signature

/// <summary>
/// Update a Card
/// </summary>
/// <param name="cardWithChanges">The card with the changes</param>
/// <param name="cancellationToken">Cancellation Token</param>
/// <returns>The Updated Card</returns>
public async Task<Card> UpdateCardAsync(Card cardWithChanges, CancellationToken cancellationToken = default) {...}

Examples

var cardId = "63c939a5cea0cb006dc9e9dd";
var cardToUpdate = await _trelloClient.GetCardAsync(cardId); //Get the card you wish to update

//Update various aspects of a card
cardToUpdate.Start = DateTimeOffset.Now;

cardToUpdate.Cover = null; //Set to Null to remove cover

cardToUpdate.LabelIds.Add("My extra Label Id"); //Add One more label (Use 'TrelloClient.GetLabelsOfBoardAsync()' to find real ids)

var updatedCard = await _trelloClient.UpdateCardAsync(cardToUpdate);

//*********************************************************************

//Move the card to another List and/or Position
var cardToMove = await _trelloClient.GetCardAsync(cardId); //Get the card you wish to update

cardToMove.ListId = "IdOfTheListToMoveTo";
cardToMove.Position = 1; //Low number to move to the top, high number to move to the bottom

await _trelloClient.UpdateCardAsync(cardToMove);

See Also

Clone this wiki locally