Smart Sheet API 2.1.1, 下载附件但是 url 不见了
Smart Sheet API 2.1.1, Download attachment but url is missing
将附件下载到本地驱动器 ##
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],URL{null}
- 附件
ID[3215061968807812], URL{null}
- 附件ID[6310196327802756],
URL{null}
- 附件 ID[5565993922652036],URL{null}
我现在明白了,迭代对象并获取附件不会给你 url,事实上你必须从该对象获取 ID,然后使用 GetAttachment 过程再次查询智能 sheet一世。 e
Attachment at = smartsheet.sheetResources().attachmentResources().getAttachment(sheetId, att.getId());
将附件下载到本地驱动器 ##
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],URL{null}
- 附件 ID[3215061968807812], URL{null}
- 附件ID[6310196327802756], URL{null}
- 附件 ID[5565993922652036],URL{null}
我现在明白了,迭代对象并获取附件不会给你 url,事实上你必须从该对象获取 ID,然后使用 GetAttachment 过程再次查询智能 sheet一世。 e
Attachment at = smartsheet.sheetResources().attachmentResources().getAttachment(sheetId, att.getId());