我试图使用C#,Visual Studio 2017连接到smartsheet api。我试图获取报表中单元格的历史记录,以便可以绘制单元格中百分比值随时间的变化。
我正在使用<package id="smartsheet-csharp-sdk" version="2.86.0" targetFramework="net461" />
我可以使用
成功地进行API调用以获取工作表的单元格历史记录 try
{
SmartsheetClient smartsheet = new SmartsheetBuilder().SetaccessToken(apiToken).Build();
paginatedResult<CellHistory> results = smartsheet.SheetResources.RowResources.CellResources.getcellHistory(
sheetId,// long sheetId
rowId,// long rowId
columnId,// long columnId
null,// IEnumerable<CellInclusion> includes
null // PaginationParameters
);
textBox1.Text = ("Found " + results.TotalCount + " results");
dataGridView2.Columns.Add("Date","Date");
dataGridView2.Columns.Add("Value","Value");
for (int i = 0; i < results.TotalCount; i++)
{
var index = dataGridView2.Rows.Add();
dataGridView2.Rows[i].Cells["Date"].Value = (System.DateTime)results.Data[i].ModifiedAt;
dataGridView2.Rows[i].Cells["Value"].Value = (double)results.Data[i].Value;
}
}
catch (Exception ex)
{
textBox1.Text = ex.ToString();
}
那很好。
我尝试使用smartsheet.ReportResources,但是当时没有RowRecources。
如果我将相同的SheetResources代码指向报表,则会出现错误
Smartsheet.Api.ResourceNotFoundException: Not Found
at Smartsheet.Api.Internal.AbstractResources.HandleError(HttpResponse response)
at Smartsheet.Api.Internal.AbstractResources.ListResourcesWithWrapper[T](String path)
at Smartsheet.Api.Internal.RowColumnResourcesImpl.getcellHistory(Int64 sheetId,Int64 rowId,Int64 columnId,IEnumerable`1 include,PaginationParameters paging,Nullable`1 level)
at Smartsheet.Api.Internal.RowColumnResourcesImpl.getcellHistory(Int64 sheetId,PaginationParameters paging)
有人可以请我提供一些有关如何获取报告中单元格历史的帮助吗?