Click or drag to resize
ZenophSMSgetSubmitStatus Method (String, Boolean, STATUSQUERY)
Gets the status of submitted destinations from a query token.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
public Dictionary<STATUSQUERY, List<string>> getSubmitStatus(
	string token,
	bool getrecpts,
	params STATUSQUERY[] states


Type: SystemString
A unique key that identifies the message which can be used to query the status of submitted destinations.
Type: SystemBoolean
Indicates whether the recipients of the message should be returned as well or not.
Type: Zenoph.SMSLib.EnumsSTATUSQUERY
The states of destinations that should be returned. Each must be separated with a comma.

Return Value

Type: DictionarySTATUSQUERY, ListString
Returns the submit status of submitted destinations.
using System;
using System.Threading;
using System.Collections.Generic;
using Zenoph.SMSLib;
using Zenoph.SMSLib.Enums;

namespace SMSTest
    public class Program
        public static void Main(String[] args)
                ZenophSMS sms = new ZenophSMS();

                // set the message.
                sms.setMessage("Hello there!");

                // add the destinations.

                // extract other phone numbers.
                List<string> numbers = sms.extractPhoneNumbers("string containing phone numbers");

                // add the phone numbers.
                foreach (string num in numbers)
                    sms.addRecipient(num, true);

                // submit the message.
                List<string[]> resp = sms.submit();

                // if the total number of destinations that were submitted is greater than
                // the maximum value for a single batch submit to return status immediately,
                // then a token was returned.

                if (sms.getRecipientsCount() > ZenophSMS.getBatchSubmitMax())
                    processTokenResponse(resp[0][0], sms);

                else    // states of destinations were immediately returned.
                    // we can show the states if there is the need.
                    foreach (string[] s in resp)
                        Console.WriteLine("Destination: {0},  Status: {1}", resp[1], resp[2]);

            catch (SMSException sex)
                Console.WriteLine("Error: {0}", sex.Message);

            catch (Exception ex)
                Console.WriteLine("Error: {0}", ex.Message);

        static void processTokenResponse(string token, ZenophSMS sms)
            if (string.IsNullOrEmpty(token))
                    throw new Exception("Invalid token for requesting submit status.");

                Dictionary<STATUSQUERY, List<string>> st = null;

                st = sms.getSubmitStatus(token, STATUSQUERY.PENDING);   // only want to know if some are pending.
            } while (Convert.ToInt32(st[STATUSQUERY.PENDING][0]) > 0);

            // at this point all message has been submitted to all destinations.
            // If we are interested in the destinations and their states, we can do that below
            st = sms.getSubmitStatus(token, true, STATUSQUERY.SUBMITTED, STATUSQUERY.REJECTED);

            // we can obtain them separately.
            List<string> submitted = st[STATUSQUERY.SUBMITTED];
            List<string> rejected  = st[STATUSQUERY.REJECTED];

            // we can do what we want to do with the returned data.
See Also