//+---------------------------------------------------------------------------
        //
        //  function:   Reassign
        //
        //  Synopsis:   Reassign the Msg
        //
        //  Arguments:  [objIncomingMsgIterator] - Iterator to the messages in inbox folder
        //                [strMsgId] - Id of the message to be reassigned
        //                [strRecipients] - Recipients to whom the message is to be assigned.
        //
        //  Returns:    bool : true if reassign was successful
        //
        //----------------------------------------------------------------------------
        static bool Reassign(FAXCOMEXLib.IFaxIncomingMessageIterator objIncomingMsgIterator, string strMsgId, string strRecipients)
        {
            bool bRetVal = false;

            if ((objIncomingMsgIterator != null) && (String.IsNullOrEmpty(strMsgId) != true) && (String.IsNullOrEmpty(strRecipients) != true))
            {
                //Goto first Msg
                objIncomingMsgIterator.MoveFirst();
                while (true)
                {
                    FAXCOMEXLib.IFaxIncomingMessage objIncomingMessage;
                    if (objIncomingMsgIterator.AtEOF)
                    {
                        System.Console.WriteLine("Reassign Message Id not found");
                        break;
                    }
                    //Get current Msg
                    objIncomingMessage = objIncomingMsgIterator.Message;
                    FAXCOMEXLib.IFaxIncomingMessage2 objIncomingMessage2 = (FAXCOMEXLib.IFaxIncomingMessage2)(objIncomingMessage);

                    if (String.Compare(objIncomingMessage2.Id, strMsgId, true, CultureInfo.CurrentCulture) == 0)
                    {
                        //Set the Msg Parameters
                        objIncomingMessage2.Subject         = SUBJECT;
                        objIncomingMessage2.SenderName      = SENDER_NAME;
                        objIncomingMessage2.Recipients      = strRecipients;
                        objIncomingMessage2.SenderFaxNumber = SENDER_FAXNUMBER;
                        //Reassign
                        objIncomingMessage2.ReAssign();
                        System.Console.WriteLine("Reassign was successful");
                        bRetVal = true;
                        break;
                    }
                    //Next Msg
                    objIncomingMsgIterator.MoveNext();
                }
                return(bRetVal);
            }
            System.Console.WriteLine("Reassign: Parameter is NULL");
            return(false);
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   getUnassignedMsg
        //
        //  Synopsis:   Get unassigned msgs
        //
        //  Arguments:  [objIncomingMsgIterator] - Iterator to the messages in inbox folder
        //                [pCount] - Referenced variable containing the number of reassignable faxes.
        //
        //  Returns:    ArrayList: Array of strings containing the mesg ids of reassignable faxes
        //
        //----------------------------------------------------------------------------
        static ArrayList getUnassignedMsg(FAXCOMEXLib.IFaxIncomingMessageIterator objIncomingMsgIterator, ref int pCount)
        {
            //Get the number of reassignable messages
            ArrayList arrMsgIds = new ArrayList();

            if (objIncomingMsgIterator != null)
            {
                //Goto first Msg
                objIncomingMsgIterator.MoveFirst();

                //Loop thru all msgs
                int i = 0;
                while (true)
                {
                    FAXCOMEXLib.IFaxIncomingMessage objIncomingMessage;
                    if (objIncomingMsgIterator.AtEOF)
                    {
                        break;
                    }
                    objIncomingMessage = objIncomingMsgIterator.Message;
                    FAXCOMEXLib.IFaxIncomingMessage2 objIncomingMessage2 = (FAXCOMEXLib.IFaxIncomingMessage2)(objIncomingMessage);
                    //if not reassigned
                    if (!objIncomingMessage2.WasReAssigned)
                    {
                        arrMsgIds.Add(objIncomingMessage2.Id);
                        i++;
                    }
                    objIncomingMsgIterator.MoveNext();
                }
                pCount = i;

                return(arrMsgIds);
            }
            System.Console.WriteLine("getUnassignedMsg: Parameter is NULL");
            return(null);
        }