Andri Yadi

Butterfly Effect
See also: Other Geeks@INDC

Send SMS to Outlook Contact - A VSTO Outlook Add-in

Imagine you can send an SMS message to a mobile phone number of an Outlook contact directly from your Outlook. Despite there are some Outlook Add-ins those allow to do that, why don't build by your own. All you need are VSTO and GSM modem, either dedicated GSM modem or a mobile phone that can be connected via COM (using USB, Bluetooth, or Infrared).

Here are some capture how our add-in will look like.

Toolbar

Custom toolbar to connect to GSM modem and display SMS form

GSM Modem Form

When you click GSM Modem button, GSM Modem form will be displayed. Fill the textfields and click connect, "Phone is connected" dialog will be shown if connection is successful.

SMS Form

Clicking Send SMS button will display SMS Form. Number will be filled automatically from Contact's mobile phone.

Ribbon

By double clicking to a contact in contact list, contact detail will be displayed. I add two controls to ribbon to connect to GSM modem. If connection has been made previously, it will not connect again. There is also a form region to send SMS directly from Contact detail.

GSM Communication

For GSM communication, I don't make it from the scratch. Instead, I use GSM Communication Library available at: http://www.scampers.org/steve/sms. Some basic knowledge about GSM Comm:

1. Make a connection to GSM modem device

public GsmCommMain GsmComm {set; get;}
 
public void Connect(int comPort, int baudRate, int timeout)
{
    try
    {
        GsmComm = new GsmCommMain(comPort, baudRate, timeout);
        GsmComm.PhoneConnected += new EventHandler(GsmComm_PhoneConnected);
        GsmComm.PhoneDisconnected += new EventHandler(GsmComm_PhoneDisconnected);
 
        GsmComm.Open();
    }
    catch (System.Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}
void GsmComm_PhoneDisconnected(object sender, EventArgs e)
{
    MessageBox.Show("Phone is disconnected");
}
 
void GsmComm_PhoneConnected(object sender, EventArgs e)
{
    MessageBox.Show("Phone is connected");
}

2. Disconnect

public void Disconnect()
{
    if (GsmComm != null && GsmComm.IsOpen())
    {
        GsmComm.PhoneConnected -= new EventHandler(GsmComm_PhoneConnected);
        GsmComm.PhoneDisconnected -= new EventHandler(GsmComm_PhoneDisconnected);
 
        GsmComm.Close();
    }
}

3. Send Short Message

public void SendSms(String phoneNo, String msg)
{
    if ((GsmComm == null) || (!GsmComm.IsOpen()))
    {
        MessageBox.Show("Phone is not connected");
        return;
    }
 
    try
    {
        SmsSubmitPdu pdu = new SmsSubmitPdu(msg, phoneNo, String.Empty);
        GsmComm.SendMessage(pdu);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

The rest code are used for building Outlook Add-in, add custom toolbar, add custom ribbon, form region, and other Windows Forms. Complete code can be downloaded at: http://dycode.com/files/folders/codesamples/entry125.aspx

I make a screencast to show you how to build this add-in step by step.

http://images.soapbox.msn.com/flash/soapbox1_1.swf?c=v&v=c2985270-5ec6-412b-bf3b-32485adf428a <p><a href="http://images.soapbox.msn.com/flash/soapbox1_1.swf?c=v&v=c2985270-5ec6-412b-bf3b-32485adf428a" target="_blank">http://images.soapbox.msn.com/flash/soapbox1_1.swf?c=v&v=c2985270-5ec6-412b-bf3b-32485adf428a</a></p>

View original media here: http://video.msn.com/video.aspx?vid=c2985270-5ec6-412b-bf3b-32485adf428a

You can download good quality video by following this link: http://cid-0cbe0e395b6f9491.skydrive.live.com/self.aspx/Public/SendSMSOutlookAddIn.zip 

That's it for now. Enjoy.

Share this post: | | | |

Comments

reyza said:

wah videonya jangan berupa link aja dong, langsung di-embed aja di blog ente, mumpung sudah dibuatin fasilitasnya. untuk video di MSN, bisa pake sintaks berikut :

[Soapbox: video.msn.com/video.aspx]

dijamin video ente bakal tayang di posting blog ente. link diatas jangan ada tag "a href"-nya.

# May 26, 2008 12:21 AM

reyza said:

hehehe...si CS nge-convert sintaks yang gw tulis menjadi link :) cek caranya di blog-nya Naren di wss-id.

wss-id.org/.../new-design-and-feature-on-wss-id.aspx

# May 26, 2008 12:24 AM

andriyadi said:

@reyza:

Thanks for the tip bro...Udah muncul video-nya, cuman kualitasnya gak bagus. Padahal sebelum di-upload, kualitas video-nya ok.

# May 26, 2008 1:03 AM

Narenda Wicaksono said:

4 Andri Yadi : Klo upload di SOAPBOX sama dia akan di convert jadi low res. Mungkin bisa di coba vendor lain, atau pakai Silverlight streaming. Anyway, blog elo keren dan sangat useful banget!

4 Reyza : Thanks for make it happen bro!

I Love Monday!

Narenda Wicaksono

# May 26, 2008 6:53 AM

andriyadi said:

@Naren:

Thx bro...thx jg suggestion-nya. Lagi malas pakai Silverlight Streaming, lama upload-nya and sering gagalnya.

# May 26, 2008 7:33 AM

Borgosa said:

Best airfares deals> low cost fares

airfare-deals.cheap-student-airfares.info/map.html

military discount on airfare

# July 17, 2008 8:19 PM

flow1800 said:

T4GUm9 gihiroef jsgiosjiogjdso igjiosdjgiodsg jwguj 94wjsdfkj gkjgl4wg dsgds

# July 22, 2008 12:03 AM

nusha said:

eiii ku je qka je ka bon a po te rrihet

# July 26, 2008 6:16 PM

ламинат said:

3qI get a lot of interesting ideas from you post- Thanks!.1t I compleatly agree with last post.  boi

I'll happy if you come here <a href="http://skuper.ru">ламинат под</a> 0j

# September 5, 2008 6:55 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 
Are you human?:  


Enter the numbers above: