尝试使用 Java API 以编程方式获取对 smartsheet 中行的注释。当我使用 row.getDiscussions() 时,即使该行上存在注释,它也始终返回 null。
try
{
Smartsheet CommericalSmartsheet = new SmartsheetBuilder().setAccessToken("*****************").build();
Sheet sheet = CommericalSmartsheet.sheetResources().getSheet(*************,null,null,null,null,null,null,null);
List<Row> rows = sheet.getRows();
System.out.println("Number of Rows: " + rows.size());
for(int x = 0; x<rows.size();x++)
{
System.out.println("Row #: " + x);
List<Discussion> discussions = rows.get(x).getDiscussions();
if (discussions != null)
{
System.out.println("Number of Discussions: " + rows.get(x).getDiscussions().size());
for(int y=0;y<discussions.size();y++)
{
List<Comment> comments = discussions.get(y).getComments();
for (int i=0;i<comments.size();i++)
{
String CommentText = comments.get(i).getText();
User createdBy = comments.get(i).getCreatedBy();
Date createdAt = comments.get(i).getCreatedAt();
System.out.println(createdBy.toString() + " " + createdAt.toString() + ": " + CommentText);
}
}
}
}
} catch (SmartsheetException ex) {
Logger.getLogger(TFSpush.class.getName()).log(Level.SEVERE, null, ex);
}
我的输出是
Number of Rows: 1026
Row #: 0
Row #: 1
Row #: 2
Row #: 3
Row #: 4
Row #: 5
Row #: 6
Row #: 7
Row #: 8
Row #: 9
Row #: 10
Row #: 11
Row #: 12
Row #: 13
Row #: 14
我不会让你厌烦剩下的只是数到 1026