public static async Task <List <AdaptiveCard> > GetApprovalsForUserCard(string accessToken, string userId) { // Get all approvals requested by current user var approvals = await DatabaseHelper.GetApprovalsAsync(a => a.Requestor == userId); if (approvals.Count() == 0) { // Return a simple message return(null); } else if (approvals.Count() == 1) { // Return status card of the only approval return(new List <AdaptiveCard>() { GetApprovalStatusCard(approvals.First()) }); } else { var approvalCardList = new List <AdaptiveCard>(); foreach (var approval in approvals) { var approvalDetailCard = new AdaptiveCard(); var approvalColumnSet = new AdaptiveColumnSet(); // Get thumbnail var thumbnailUri = await GraphHelper.GetFileThumbnailDataUri(accessToken, approval.File.Id); var fileThumbCol = new AdaptiveColumn() { Width = AdaptiveColumnWidth.Auto.ToLower() }; fileThumbCol.Items.Add(new AdaptiveImage() { Url = new Uri(thumbnailUri), AltText = "File thumbnail", Size = AdaptiveImageSize.Small }); approvalColumnSet.Columns.Add(fileThumbCol); var fileNameCol = new AdaptiveColumn() { Width = AdaptiveColumnWidth.Stretch.ToLower() }; fileNameCol.Items.Add(new AdaptiveTextBlock() { Size = AdaptiveTextSize.Medium, Text = approval.File.Name }); fileNameCol.Items.Add(new AdaptiveTextBlock() { IsSubtle = true, Spacing = AdaptiveSpacing.None, Text = $"Requested: {TimeZoneHelper.GetAdaptiveDateTimeString(approval.RequestDate)}" }); approvalColumnSet.Columns.Add(fileNameCol); approvalDetailCard.Body.Add(approvalColumnSet); approvalDetailCard.Actions.Add(new AdaptiveSubmitAction() { Title = "This one", DataJson = $@"{{ ""cardAction"": ""{CardActionTypes.SelectApproval}"", ""selectedApproval"": ""{approval.Id}"" }}" }); approvalCardList.Add(approvalDetailCard); } return(approvalCardList); } }