c# - LinkedIn send a message -
i want send message linkedin user connections. try following code:
string s = @"<?xml version='1.0' encoding='utf-8'?> <mailbox-item> <recipients> <recipient> <person path='/people/1234567' /> </recipient> </recipients> <subject>congratulations on test.</subject> <body>test here</body> </mailbox-item>"; string url = "https://api.linkedin.com/v1/people/~/mailbox?oauth2_access_token=xxxxxxxxxxxx"; httpwebrequest webrequest = webrequest.create(url) httpwebrequest; webrequest.timeout = 10000; webrequest.contenttype = "text/xml"; webrequest.method = "post"; using (var writer = new streamwriter(webrequest.getrequeststream())) { writer.write(s); } webresponse response = webrequest.getresponse();
i exception "the remote server returned error: (400) bad request." on last string. incorrectly?
Comments
Post a Comment