在钉钉如何获取用户审批评论里的附件?
                                                    使用新版SDK时,除了需要pid和文件的fileId还需要将请求参数withCommentAttatchment设置为true:
    public String getProcessAttachmentV2(String processInstanceId, String fileId) {
        // {field,processInstanceId,withCommentAttatchment}
        com.aliyun.dingtalkworkflow_1_0.Client client = getWorkflowClient();
        GrantProcessInstanceForDownloadFileRequest request = new GrantProcessInstanceForDownloadFileRequest();
        request.setProcessInstanceId(processInstanceId);
        request.setFileId(fileId);
        request.setWithCommentAttatchment(true);
        GrantProcessInstanceForDownloadFileHeaders headers = new GrantProcessInstanceForDownloadFileHeaders();
        headers.xAcsDingtalkAccessToken = getToken();
        try {
            GrantProcessInstanceForDownloadFileResponse response = client.grantProcessInstanceForDownloadFileWithOptions(request, headers, new RuntimeOptions());
            log.debug(response.getBody().toString());
            return response.getBody().getResult().getDownloadUri();
        } catch (Exception e) {
            log.error(e.getMessage());
            return '获取错误';
        }
    }
这样response.getBody().getResult().getDownloadUri()就可以拿到钉钉中附件的下载URL咯!
                                                    
                                                        赞1
                                                        踩0