weixin_44984517
2020-05-15 10:00 阅读 440

.net core webapi 钉钉服务端API 上传媒体文件接口 不合法的媒体文件40004

请开发过的大佬指教下

try
{
        IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/media/upload");
        OapiMediaUploadRequest req = new OapiMediaUploadRequest();
        req.Type = "image";
        string webRootPath = _environment.WebRootPath;
        string url = webRootPath.Replace(@"\", @"/") + "/media/"+" 20200512112734.jpg";

        req.Media = new FileItem(url);
        OapiMediaUploadResponse rsp = client.Execute(req, access_token);

        return rsp.MediaId;
}
catch (Exception ex)
{

        return "错误信息:"+ex;
}

类型肯定没问题的image

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

相关推荐