上传图文消息内的图片

企业微信上传图文消息内使用的图片,得到图片URL,该URL永久有效,可以参考代码:

Dim url As String = "https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg?access_token={0}"
Dim
hc As new HttpClient(CExp(url, Functions.Execute("GetQYAccessToken")))
hc
.Files.Add("media","c:\data\006.jpg") '指定要上传的图片文件
Dim
jo As JObject = JObject.Parse( hc.getdata)
If
jo("errcode") Is Nothing Then
    Dim dr As DataRow = DataTables("Materials").AddNew()
    dr("URL") = jo("url")
    dr("Description") =
"
永久图文消息内的图片"
    dr.Save()

Else

    MessageBox.Show(jo.ToString)

End
If


本页地址:http://www.foxtable.com/mobilehelp/topics/0230.htm