send SMS to a particular set of users using only OCS(OfficeCommunications server)

N

Nithin

Hi all,

I have a scenario where I need to send SMS to a particular set of
users using only OCS(Office Communications server 2007).

I tried a lot to find out the logic on how i can implement this but
nothing useful i found.

Can anyone suggest me how i can implement it or any useful links.

Thanks in Advance
Nithin
 
D

David

Hi,

I don't know what Office Communications Server is,but I am successfully
(almost, though I am about to start a new thread) with my encoding problem)
sending SMS through these...

http://www.txtlocal.co.uk/signup/

I am using this code... but I have a slight problem with it... (mainly
encoding, but that will be another thread)

public string SendMessage(string From, string Number, string Message)
{
string result = string.Empty;
string strPost = string.Empty;

string SMSUrl = ConfigurationManager.AppSettings["SMSUrl"];
string User = ConfigurationManager.AppSettings["SMSUser"];
string Pass = ConfigurationManager.AppSettings["SMSPass"];

Number = Number.Replace("+", string.Empty);

string TestMode = string.Empty;
try
{
if
(ConfigurationManager.AppSettings["SMSTestMode"].ToLower() == "true")
{
TestMode = "&test=1";
//Number = "998" + Number;
}
}
catch
{
}


strPost = "uname=" + User + "&pword=" + Pass + "&message=" +
Message + "&from=" + From + "&selectednums=" + Number + "&info=1" +
TestMode;

StreamWriter myWriter = null;
HttpWebRequest objRequest =
(HttpWebRequest)WebRequest.Create(SMSUrl);

//add Proxy info if required
//objRequest.Proxy = WebProxy.GetDefaultProxy();
//objRequest.Proxy.Credentials =
CredentialCache.DefaultCredentials; //uses logged on user
//objRequest.Proxy.Credentials = new
System.Net.NetworkCredential("UserName", "Password"); // Alternative -
specify the user and password to use
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream(),
System.Text.Encoding);
myWriter.Write(strPost);
}
catch (Exception e)
{
return e.Message;
}
finally
{
myWriter.Close();
}

HttpWebResponse objResponse =
(HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr = new
StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;

}
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
D

David

Oops, I left a little bit of bad code...

The line

myWriter = new StreamWriter(objRequest.GetRequestStream(),
System.Text.Encoding);

should be

myWriter = new StreamWriter(objRequest.GetRequestStream());


--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

David said:
Hi,

I don't know what Office Communications Server is,but I am successfully
(almost, though I am about to start a new thread) with my encoding
problem) sending SMS through these...

http://www.txtlocal.co.uk/signup/

I am using this code... but I have a slight problem with it... (mainly
encoding, but that will be another thread)

public string SendMessage(string From, string Number, string Message)
{
string result = string.Empty;
string strPost = string.Empty;

string SMSUrl = ConfigurationManager.AppSettings["SMSUrl"];
string User = ConfigurationManager.AppSettings["SMSUser"];
string Pass = ConfigurationManager.AppSettings["SMSPass"];

Number = Number.Replace("+", string.Empty);

string TestMode = string.Empty;
try
{
if
(ConfigurationManager.AppSettings["SMSTestMode"].ToLower() == "true")
{
TestMode = "&test=1";
//Number = "998" + Number;
}
}
catch
{
}


strPost = "uname=" + User + "&pword=" + Pass + "&message=" +
Message + "&from=" + From + "&selectednums=" + Number + "&info=1" +
TestMode;

StreamWriter myWriter = null;
HttpWebRequest objRequest =
(HttpWebRequest)WebRequest.Create(SMSUrl);

//add Proxy info if required
//objRequest.Proxy = WebProxy.GetDefaultProxy();
//objRequest.Proxy.Credentials =
CredentialCache.DefaultCredentials; //uses logged on user
//objRequest.Proxy.Credentials = new
System.Net.NetworkCredential("UserName", "Password"); // Alternative -
specify the user and password to use
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream(),
System.Text.Encoding);
myWriter.Write(strPost);
}
catch (Exception e)
{
return e.Message;
}
finally
{
myWriter.Close();
}

HttpWebResponse objResponse =
(HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr = new
StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;

}
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Nithin said:
Hi all,

I have a scenario where I need to send SMS to a particular set of
users using only OCS(Office Communications server 2007).

I tried a lot to find out the logic on how i can implement this but
nothing useful i found.

Can anyone suggest me how i can implement it or any useful links.

Thanks in Advance
Nithin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top