我们正在尝试构建一个界面,该界面可以汇总所有工作表中的任务。因此,我尝试使用 Search 方法,使用名称或电子邮件地址作为查询,然后遍历结果检查 SearchObjectType 是否为 ROW。我确实得到了结果,但它们并不完整。有没有更好的方法来解决这个问题?
string query = "name@domain.org";
IList<SearchResultItem> results = smartsheet.SearchResources.Search(query).Results;
foreach (SearchResultItem result in results)
{
if (result.ObjectType == SearchObjectType.ROW)
{
Sheet thisSheet = smartsheet.SheetResources.GetSheet(result.ParentObjectId.Value, new SheetLevelInclusion[] { SheetLevelInclusion.ROW_PERMALINK }, null, null, null, null, null, null);
Row row = smartsheet.SheetResources.RowResources.GetRow(result.ParentObjectId.Value, result.ObjectId.Value, new RowInclusion[] { RowInclusion.COLUMNS, RowInclusion.ROW_PERMALINK, RowInclusion.COLUMN_TYPE, RowInclusion.FORMAT }, null);
string rowData = string.Empty;
Console.WriteLine("Sheet info: " + thisSheet.Name + " " + thisSheet.Permalink);
foreach (Cell cell in row.Cells)
{
rowData += cell.DisplayValue + ",";
}
Console.WriteLine(rowData);
}
}