Micro application is the site of E comes nailed application difficult to use, and the front-end UI is not very good, so tend to use the site for development
String UrlUserID = " https://oapi.dingtalk.com/message/send?access_token= " + token; // Get your own Token String the PostData = " {\" TOUSER \ ": \" \ ", " ; // employee code, I do not know what to check on the address book, multiple please use the "|" to distinguish the PostData + = " \" toparty \ ": \" \ ", " ; // department code, employee code and department code can not all empty the PostData + = " \" agentId \ ": \" \ ", " ; // application code in the PostData + = " \" MsgType \ ": \" text \ ", " ;// Message Type the PostData + = " \"text\":{ "; PostData += " \"content\":\"37889\" "; //消息内容 PostData += " }}";
Response.Write(PostDataGetHtml(UrlUserID, PostData));
public string PostDataGetHtml(string uri, string postData) { try { byte[] data = Encoding.UTF8.GetBytes(postData); Uri uRI = new Uri(uri); HttpWebRequest req = WebRequest.Create(uRI) as HttpWebRequest; req.Method = "POST"; req.KeepAlive = true; req.ContentType = "application/json"; req.ContentLength = data.Length; req.AllowAutoRedirect = true; Stream outStream = req.GetRequestStream(); outStream.Write(data, 0, data.Length); outStream.Close(); HttpWebResponse res = req.GetResponse() as HttpWebResponse; Stream inStream = res.GetResponseStream(); StreamReader sr = new StreamReader(inStream, Encoding.UTF8); string htmlResult = sr.ReadToEnd(); returnhtmlResult; } the catch (Exception EX) { return " Network Error: " + ex.Message.ToString (); } }