I want to be able to send a row, from a report, via email with only specific columns via the API.
The API docs clearly show you how to send a row via email however, I'm unable to get the column ids inside the report in order to send those specific columns. I'm using the following to try and output the column Title and Id. The title will show successfully however the IDs show blank. Is there a reason for this?
Report report = ss.ReportResources.GetReport(
reportid, // long reportId
null, // IEnumerable<ReportInclusion>
null, // int pageSize
null // int page
);
foreach(var Col in report.Columns)
{
Console.WriteLine($"Title:{Col.Title} ID:{Col.Id}");
}
You should call virtualId
Console.WriteLine($"Title:{Col.Title} ID:{Col.VirtualId}");
base on https://smartsheet-platform.github.io/api-docs/#reportcolumn-object
A report column is a "virtual" column, in that it appears identical to source sheet columns, but is in fact a different column belonging to the report. Cells in the report refer to this column via their virtualColumnId attribute, and to their actual column from their source sheet via their columnId attribute.
base on https://smartsheet-platform.github.io/api-docs/?csharp#get-report
{
"id": 4583173393803140,
"name": "My Report",
"totalRowCount": 4,
"accessLevel": "OWNER",
"permalink": "https://app.smartsheet.com/b/home?lx=pWNSDH9itjBXxBzFmyf-5w",
"createdAt": "2012-07-24T18:22:29-07:00",
"modifiedAt": "2012-07-24T18:30:52-07:00",
"columns": [
{
"virtualId": 4583173393803140,
"version": 0,
"index": 0,
"primary": true,
"title": "Sheet Name",
"type": "TEXT_NUMBER",
"validation": false,
"sheetNameColumn": true
},
{
"virtualId": 2331373580117892,
"version": 0,
"index": 1,
"title": "Status",
"type": "TEXT_NUMBER",
"validation": false
}
],
"rows": [
{
"id": 1732835527681924,
"sheetId": 1060338138408836,
"rowNumber": 1,
"expanded": true,
"accessLevel": "OWNER",
"createdAt": "2014-10-02T15:05:35-07:00",
"modifiedAt": "2014-10-02T15:05:35-07:00",
"cells": [
{
"virtualColumnId": 4583173393803140,
"type": "TEXT_NUMBER",
"value": "My Sheet",
"displayValue": "My Sheet"
},
{
"columnId": 8467747974735748,
"virtualColumnId": 2331373580117892,
"type": "TEXT_NUMBER",
"value": "In Progress",
"displayValue": "In Progress"
}
]
}
]
}