Smart Sheet API 2.1.1,下载附件但缺少url

时间:2017-05-27 11:35:52

标签: smartsheet-api smartsheet-java-sdk-v2 smartsheet-java-sdk-v1 smartsheet-api-2.0

将附件下载到本地驱动器##

        for(Row r : rows){

        PagedResult<Attachment> attachments = smartsheet.sheetResources().rowResources().attachmentResources().getAttachments(sheetId, r.getId(), null);


        System.out.println("attachments"+attachments.getData().size());


        if(attachments.getData().size() > 0){

        for(Attachment at : attachments.getData()){

                      System.out.println(String.format("Attachement ID[%s], URL{%s}",at.getId(),at.getUrl()));

        }

输出:

  • 附件ID [2625191160375172],网址{null}
  • Attachement ID [3215061968807812],URL {null}
  • 附件ID [6310196327802756], 网址{null}
  • 附件ID [5565993922652036],网址{null}

1 个答案:

答案 0 :(得分:0)

我现在明白了,迭代对象并伸出attachement将不会给你url,事实上你必须从该对象获取id然后再使用GetAttachment过程查询智能表i。 ë

  Attachment at = smartsheet.sheetResources().attachmentResources().getAttachment(sheetId, att.getId());