Smartsheet Java API 进行讨论
Smartsheet Java API Getting Discussions
尝试通过 Java API 以编程方式获取对智能表中行的评论。当我使用 row.getDiscussions() 它总是 returns 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
请尝试使用 SheetInclusion.DISCUSSIONS,因为您正在获取 sheet:
Set<SheetInclusion> inclusionSet = Collections.singleton(SheetInclusion.DISCUSSIONS);
Sheet sheet = CommericalSmartsheet.sheetResources().getSheet(*************,inclusionSet,null,null,null,null,null,null);
有关详细信息,请参阅 SDK 文档中的 SheetResources.getSheet() method, and the SheetInclusion Enum。
尝试通过 Java API 以编程方式获取对智能表中行的评论。当我使用 row.getDiscussions() 它总是 returns 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
请尝试使用 SheetInclusion.DISCUSSIONS,因为您正在获取 sheet:
Set<SheetInclusion> inclusionSet = Collections.singleton(SheetInclusion.DISCUSSIONS);
Sheet sheet = CommericalSmartsheet.sheetResources().getSheet(*************,inclusionSet,null,null,null,null,null,null);
有关详细信息,请参阅 SDK 文档中的 SheetResources.getSheet() method, and the SheetInclusion Enum。