-
Notifications
You must be signed in to change notification settings - Fork 2
AddCardAsync
Jon McShurley edited this page Apr 29, 2024
·
10 revisions
Add a Card
/// <summary>
/// Add a Card
/// </summary>
/// <param name="card">The Card to Add</param>
/// <param name="cancellationToken">Cancellation Token</param>
/// <returns>The Added Card</returns>
public async Task<Card> AddCardAsync(Card card, CancellationToken cancellationToken = default) {...}
string listIdToAddTheCardTo = "63d128787441d05619f44dbe"; //Use 'TrelloClient.GetListsOnBoardAsync()' to find real list Ids
//Add a simple Card
var newSimpleCard = new Card(listIdToAddTheCardTo, "My Card Name/Title");
var addedSimpleCard = await _trelloClient.AddCardAsync(newSimpleCard);
//Add various things on a card
var newAdvancedCard = new Card(listIdToAddTheCardTo, "My Advanced Card Name/Title", "My Description");
newAdvancedCard.Start = DateTimeOffset.Now;
newAdvancedCard.Due = DateTimeOffset.Now.AddDays(7);
newAdvancedCard.Cover = new CardCover(CardCoverColor.Blue, CardCoverSize.Full);
newAdvancedCard.LabelIds = new List<string> { "LabelId1", "LabelId2" }; //Use 'TrelloClient.GetLabelsOfBoardAsync()' to find real ids
newAdvancedCard.MemberIds = new List<string> { "MemberId" }; //Use 'TrelloClient.GetMembersOfBoardAsync()' to find real Ids
newAdvancedCard.Position = 1.0m; //find other card in list to see their position and give a lower/higher value
var addedAdvancedCard = await _trelloClient.AddCardAsync(newAdvancedCard);
If you are looking for info on a specific method in TrelloDotNet then expand the Pages above and input the 'MethodName' (Example: 'AddCardAsync')