You need to sign in to do that
Don't have an account?
Send a private message from .Net Application
Hello,
I am trying to sending private message from my .Net application via Post method but private message is not send. I am not also getting any exception in my code.
URL and Parameter
URL : https://login.salesforce.com/services/data/v27.0/chatter/users/me/messages?
Parameter : "recipients=005d0000001TowVAAA&Hi this just test"
Here is my code.
======================
public
string HttpPost(string URI, string Parameters)
{
System.IO.
StreamReader sr = null;
try
{
string InstanceURL = ApttusSessionManager.GetSessionServerUrl(true);
string SessionId = ApttusSessionManager.SalesForceSession.SessionHeaderValue.sessionId;
System.Net.
WebRequest req = System.Net.WebRequest.Create(XmlAuthorUtil.GetFrontDoorURL(InstanceURL, SessionId, "/chatter/users/me/messages/"));
req.ContentType =
"application/x-www-form-urlencoded";
req.Method =
"POST";
// Add parameters to post
byte[] data = System.Text.Encoding.ASCII.GetBytes(Parameters);
req.ContentLength = data.Length;
System.IO.
Stream os = req.GetRequestStream();
os.Write(data, 0, data.Length);
os.Close();
// Do the post and get the response.
System.Net.
WebResponse resp = req.GetResponse();
if (resp == null) returnnull;
sr =
new System.IO.StreamReader(resp.GetResponseStream());
}
Please let me know if anything mistake in my code
Regards,
Keyur Patel
Hi,
I have resolved the issue using Json content type and post my message.
Regards.
Keyur Patel