最近在研究钉钉的接口,有如下几个问题一直困扰着我,还请老师指教。1.关于c# 中引用的各命名空间怎么处理? 如
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;之类的
2.关于类的定义,方法的定义? 是放在全局代码还是内部函数中?
3.外部的DLL,特别是json的dll,怎么引用?
4.语法上要注意的细节?
一直移植不成功,还请指教。
我在foxtable 的内部函数中增加了一个post函数
Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8")'编码格式
Dim strURL As String = args(0)
Dim request As System.Net.HttpWebRequest
request = directcast(System.Net.HttpWebRequest.Create(strURL),system.net.httpwebrequest)
' System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)
request.Method = "POST"
request.C
Dim paraUrlCoded As String = args(1)
'Byte[] payload
Dim payload() As Byte
payload = System .Text. Encoding.UTF8.GetBytes (paraUrlCoded)
request.ContentLength = payload. Length
Dim writer As system.IO.Stream = request. GetRequestStream() ' by wk
writer.Write (payload, 0, payload .Length)
writer.Close ()
Dim response As System.Net.HttpWebResponse
'response = (System .Net. HttpWebResponse)request .GetResponse()
response = DirectCast(request.GetResponse, System.Net.HttpWebResponse)
'response = System .Net. HttpWebResponse.request .GetResponse()
Dim s As System.IO.Stream
s = response.GetResponseStream()
Dim StrDate As String = ""
Dim strValue As String = ""
'Using
Dim Reader As System.IO.StreamReader = New System.IO.StreamReader(s, encoding)
'Dim Reader As StreamReader = new StreamReader(s, Encoding .UTF8)
'End using
Do While (StrDate = Reader.ReadLine()) <> ""
'strValue =strValue + StrDate & vbcrlf &
strValue =strValue + StrDate
Loop
MessageBox.Show(strvalue)
Return Nothing
然后在窗口中设计了一个按钮:
Dim access_token As String= "xxxx"
Dim url As String = "https://oapi.dingtalk.com/message/send?access_token=" & access_token
Dim param As String = "{""access_token"":""xxxxx""}"
'MessageBox.Show(param)
Functions.Execute("Post",url,param)