Outlook VSTO C# Make post to html url -
i making plugin outlook 2010 using vs2010 c#.
the objective of plugin grab to, cc, bc new email when custom button pressed ribbon , post external url (which takes in post request). similar how forms in html/jsp can post inputs different page(url).
so far, can grab to,cc,bc , store in string variable. don't know how make post external url.
any appreciated. thanks.
here code function far:
public void makepost(object item, ref bool cancel) { outlook.mailitem myitem = item outlook.mailitem; if (myitem != null) { string emailto = myitem.to; string emailcc = myitem.cc; string emailbcc = myitem.bcc; if (emailto == null && emailcc == null && emailbcc == null) { messagebox.show("there no recipients check."); } else { string emailadresses = string.concat(emailto, "; ", emailcc, "; ", emailbcc); //do here post string(emailaddresses) url. } } }
you need use webrequest / httpwebrequest class, example:
httpwebrequest request = httpwebrequest.create("http://google.com/postmesmth") httpwebrequest; request.method = webrequestmethods.http.post; request.host = "google.com"; request.useragent = "mozilla/5.0 (windows nt 6.1; wow64; rv:22.0) gecko/20100101 firefox/22.0"; string data = "mydata=" + httputility.urlencode("hello world!"); streamwriter writer = new streamwriter(request.getrequeststream()); writer.write(data); writer.close(); httpwebresponse response = request.getresponse() httpwebresponse;
Comments
Post a Comment