// smartsheet.sheetResources().commentResources().attachmentResources().attachFile(sheetId,
  // commentId, file,"text/plain");
  public void testattachFileComment() throws SmartsheetException, IOException {
    // create comment to add to discussion
    Comment comment = new Comment.AddCommentBuilder().setText("This is a test comment").build();

    Discussion discussion =
        new Discussion.CreateDiscussionBuilder()
            .setTitle("New Discussion")
            .setComment(comment)
            .build();
    discussion =
        smartsheet.sheetResources().discussionResources().createDiscussion(sheetId, discussion);

    // comment =
    // smartsheet.sheetResources().discussionResources().comments().addComment(sheetId,discussion.getId(), comment);
    comment = discussion.getComments().get(0);
    commentId = comment.getId();
    discussionId = discussion.getId();

    File file1 = new File("src/integration-test/resources/small-text.txt");
    // attach file to comment
    Attachment attachment =
        smartsheet
            .sheetResources()
            .commentResources()
            .attachmentResources()
            .attachFile(sheetId, commentId, file1, "text/plain");
    testGetAttachmentComment(attachment.getId());
  }
コード例 #2
0
 public void testDeleteComment() throws SmartsheetException, IOException {
   smartsheet
       .sheetResources()
       .commentResources()
       .deleteComment(newSheet.getId(), newComment.getId());
   deleteSheet(newSheet.getId());
 }
コード例 #3
0
  public void testGetComment() throws SmartsheetException, IOException {
    Comment comment =
        smartsheet
            .sheetResources()
            .commentResources()
            .getComment(newSheet.getId(), newComment.getId());

    assertNotNull(comment);
  }