mCore™ .NET SMS Library 1.2

vCard.SendFile Method

Description:

The SendFile method reads a vCard file (.vcf file) from a specified path on the disk and sends it as a vCard SMS to the mobile phone specified in the Destination property.

If the vCard message is long and cannot be sent as one single SMS, then it is split in to multiple parts and sent as a concatenated SMS.
 

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)

Parameters:

vCardFile: The complete path for the vCard file which is to be sent as SMS.

Remarks:

Exceptions:

mCore.vCardException
mCore.GeneralException

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS

   Public Sub SendVCardFile()
      Dim objVCARD As mCore.vCard = objSMS.vCard
      Try
         SetCommParameters()
         objVCARD.Destination = "+919873094767"

         'Send the vCard
         objVCARD.SendFile("c:\john doe.vcf")

         MsgBox("vCard sent!", MsgBoxStyle.Information, strMyAppName)

      Catch ex As mCore.vCardException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As Exception
      End Try
   End Sub

   Public Sub SetCommParameters()
      Try
         objSMS.Port = "COM1"
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200
         objSMS.DataBits = mCore.DataBits.Eight
         objSMS.StopBits = mCore.StopBits.One
         objSMS.Parity = mCore.Parity.None
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message)
      Catch ex As Exception
      End Try
   End Function
End Class

 
C#
class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();

   public static void SendVCard()
   {
      mCore.vCard objVCARD = objSMS.vCard();
      try
      {

         SetCommParameters();
         objVCARD.Destination = "+919873094767";

         //Send the vCard
         objVCARD.SendFile("c:\john doe.vcf");
         MessageBox.Show("vCard sent!");
      }

      catch (mCore.vCardException e)
      {
         MessageBox.Show(e.ToString());
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }

   public static void SetCommParameters()
   {
      try
      {
         objSMS.Port = "COM1";
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200;
         objSMS.DataBits = mCore.DataBits.Eight;
         objSMS.StopBits = mCore.StopBits.One;
         objSMS.Parity = mCore.Parity.None;
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS;
      }
      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }
}

See Also:

vCard.Destination Property

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved