Delete SMS from SmartPhone/PDA Inbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LTCCTL
    New Member
    • Feb 2008
    • 49

    Delete SMS from SmartPhone/PDA Inbox

    Hi,

    I have created a SmartPhone/PDA application to send and recieve SMS. Now whenever the application is running and the message comes in, it is shown on the screen and is strored in the inbox(I have tried both the options Notify and NotifyAndDelete but I am not satisfied with that).


    I want to delete a SMS from SmartPhone/PDA inbox which has a specific word or string.

    I am using compact framework and C#.NET.

    Please let me know how we can do it.

    Thanks in advance

    Regards
    LTCCTL
  • markmcgookin
    Recognized Expert Contributor
    • Dec 2006
    • 648

    #2
    I think there are some classes for Windows Mobile's telephony or pocket outlook things that would allow you to do this.

    You would probably have to loop through each message, pass it to a string reader, then parse the string for your word. If you find the word delete the message.

    Comment

    • LTCCTL
      New Member
      • Feb 2008
      • 49

      #3
      Originally posted by markmcgookin
      I think there are some classes for Windows Mobile's telephony or pocket outlook things that would allow you to do this.

      You would probably have to loop through each message, pass it to a string reader, then parse the string for your word. If you find the word delete the message.
      Hi,

      Thanks for your help.

      I have done it

      Regards
      LTCCTL

      Comment

      • markmcgookin
        Recognized Expert Contributor
        • Dec 2006
        • 648

        #4
        Originally posted by LTCCTL
        Hi,

        Thanks for your help.

        I have done it

        Regards
        LTCCTL
        It's always good for communities like this if you post the solution you have come up with. It allows other people to use the answer and saves them having to post and wait for replies.

        Also it makes you look smart :)

        Comment

        • victorhu
          New Member
          • Aug 2008
          • 7

          #5
          1.
          sm = new Microsoft.Windo wsMobile.Pocket Outlook.Message Interception.Me ssageIntercepto r
          (Microsoft.Wind owsMobile.Pocke tOutlook.Messag eInterception.I nterceptionActi on.NotifyAndDel ete,true ) //after listening ,delete message


          or
          if (!File.Exists(F ILE_NAME))
          ......{
          OutlookSession outSess = new OutlookSession( );
          SmsMessageFolde r smsFlr = outSess.SmsAcco unt.Inbox;

          if (smsFlr.Count > 0)
          ......{
          // Only save the first sms found
          SmsMessage smsMsg = smsFlr[0];
          if (smsMsg.Body.Le ngth > 0)
          ......{
          StreamWriter writeStream = File.CreateText (FILE_NAME);
          writeStream.Wri teLine(smsMsg.B ody);
          writeStream.Clo se();
          }
          smsMsg.Delete() ;


          2. use AT instructions
          AT+CMGD=<messag e Index>

          Comment

          • victorhu
            New Member
            • Aug 2008
            • 7

            #6
            Alough I know how to delete SMS message,I'm still interested in how did you solve this problem.

            -------------------------------Victor Hu

            Comment

            • raks007
              New Member
              • Jul 2009
              • 1

              #7
              I tried below code snippet to delete

              Getting error on this line SmsMessageFolde r smsFlr = outSess.SmsAcco unt.Inbox; saying No priveleges to access SmsAccount.Inbo x

              Can somebody help with this or post a working snippet to delete message from inbox


              OutlookSession outSess = new OutlookSession( );
              SmsMessageFolde r smsFlr = outSess.SmsAcco unt.Inbox;

              if (smsFlr.Count > 0)
              ......{
              // Only save the first sms found
              SmsMessage smsMsg = smsFlr[0];
              if (smsMsg.Body.Le ngth > 0)
              ......{
              StreamWriter writeStream = File.CreateText (FILE_NAME);
              writeStream.Wri teLine(smsMsg.B ody);
              writeStream.Clo se();
              }
              smsMsg.Delete() ;

              Comment

              Working...