Inheritance: ListSubscriber
        static void Test_AddSubscriberToList()
        {

            string NewListName = "CSharpSDKAddSubscriberToList";
            string SubscriberTestEmail = "*****@*****.**";

            Console.WriteLine("--- Testing AddSubscriberToList ---");
            ET_Client myclient = new ET_Client();

            Console.WriteLine("\n Create List");
            ET_List postList = new ET_List();
            postList.AuthStub = myclient;
            postList.ListName = NewListName;
            PostReturn prList = postList.Post();

            if (prList.Status && prList.Results.Length > 0)
            {
                int newListID = prList.Results[0].Object.ID;

                Console.WriteLine("\n Create Subscriber on List");
                FuelReturn hrAddSub = myclient.AddSubscribersToList(SubscriberTestEmail, new List<int>() { newListID });
                Console.WriteLine("Helper Status: " + hrAddSub.Status.ToString());
                Console.WriteLine("Message: " + hrAddSub.Message.ToString());
                Console.WriteLine("Code: " + hrAddSub.Code.ToString());

                Console.WriteLine("\n Retrieve all Subscribers on the List");
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = myclient;
                getListSub.Props = new string[] { "ObjectID", "SubscriberKey", "CreatedDate", "Client.ID", "Client.PartnerClientKey", "ListID", "Status" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { newListID.ToString() } };
                GetReturn getResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getResponse.Status.ToString());
                Console.WriteLine("Message: " + getResponse.Message.ToString());
                Console.WriteLine("Code: " + getResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getResponse.Results.Length);
                foreach (ET_List_Subscriber ResultListSub in getResponse.Results)
                {
                    Console.WriteLine("--ListID: " + ResultListSub.ListID + ", SubscriberKey(EmailAddress): " + ResultListSub.SubscriberKey);
                }

                Console.WriteLine("\n Delete List");
                postList.ID = newListID;
                DeleteReturn drList = postList.Delete();
                Console.WriteLine("Delete Status: " + drList.Status.ToString());
            }
        }
        static void TestET_ListSubscriber()
        {

            string NewListName = "CSharpSDKListSubscriber";
            string SubscriberTestEmail = "*****@*****.**";

            Console.WriteLine("--- Testing ListSubscriber ---");
            ET_Client myclient = new ET_Client();

            Console.WriteLine("\n Create List");
            ET_List postList = new ET_List();
            postList.AuthStub = myclient;
            postList.ListName = NewListName;
            PostReturn prList = postList.Post();

            if (prList.Status && prList.Results.Length > 0)
            {
                int newListID = prList.Results[0].Object.ID;

                Console.WriteLine("\n Create Subscriber on List");
                ET_Subscriber postSub = new ET_Subscriber();
                postSub.Lists = new ET_SubscriberList[] { new ET_SubscriberList() { ID = newListID } };
                postSub.AuthStub = myclient;
                postSub.EmailAddress = SubscriberTestEmail;
                postSub.Attributes = new FuelSDK.ET_ProfileAttribute[] { new ET_ProfileAttribute() { Name = "First Name", Value = "ExactTarget Example" } };
                PostReturn postResponse = postSub.Post();
                Console.WriteLine("Post Status: " + postResponse.Status.ToString());
                Console.WriteLine("Message: " + postResponse.Message.ToString());
                Console.WriteLine("Code: " + postResponse.Code.ToString());
                Console.WriteLine("Results Length: " + postResponse.Results.Length);


                if (!postResponse.Status)
                {
                    if (postResponse.Results.Length > 0 && postResponse.Results[0].ErrorCode == 12014)
                    {
                        // If the subscriber already exists in the account then we need to do an update.
                        //Update Subscriber On List 
                        Console.WriteLine("\n Update Subscriber to add to List");
                        PatchReturn patchResponse = postSub.Patch();
                        Console.WriteLine("Post Status: " + patchResponse.Status.ToString());
                        Console.WriteLine("Message: " + patchResponse.Message.ToString());
                        Console.WriteLine("Code: " + patchResponse.Code.ToString());
                        Console.WriteLine("Results Length: " + patchResponse.Results.Length);
                    }
                }

                Console.WriteLine("\n Retrieve all Subscribers on the List");
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = myclient;
                getListSub.Props = new string[] { "ObjectID", "SubscriberKey", "CreatedDate", "Client.ID", "Client.PartnerClientKey", "ListID", "Status" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { newListID.ToString() } };
                GetReturn getResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getResponse.Status.ToString());
                Console.WriteLine("Message: " + getResponse.Message.ToString());
                Console.WriteLine("Code: " + getResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getResponse.Results.Length);
                foreach (ET_List_Subscriber ResultListSub in getResponse.Results)
                {
                    Console.WriteLine("--ListID: " + ResultListSub.ID + ", SubscriberKey(EmailAddress): " + ResultListSub.SubscriberKey);
                }
            }


            //Console.WriteLine("Retrieve Filtered ListSubscribers with GetMoreResults");
            //ET_ListSubscriber oe = new ET_ListSubscriber();
            //oe.authStub = myclient;
            //oe.SearchFilter = new SimpleFilterPart() { Property = "EventDate", SimpleOperator = SimpleOperators.greaterThan, DateValue = new DateTime[] { filterDate } };
            //oe.props = new string[] { "ObjectID", "SubscriberKey", "CreatedDate", "Client.ID", "Client.PartnerClientKey", "ListID", "Status" };
            //GetReturn oeGet = oe.Get();

            //Console.WriteLine("Get Status: " + oeGet.Status.ToString());
            //Console.WriteLine("Message: " + oeGet.Message.ToString());
            //Console.WriteLine("Code: " + oeGet.Code.ToString());
            //Console.WriteLine("Results Length: " + oeGet.Results.Length);
            //Console.WriteLine("MoreResults: " + oeGet.MoreResults.ToString());
            //// Since this could potentially return a large number of results, we do not want to print the results
            ////foreach (ET_ListSubscriber ListSubscriber in oeGet.Results)
            ////{
            ////    Console.WriteLine("SubscriberKey: " + ListSubscriber.SubscriberKey + ", EventDate: " + ListSubscriber.EventDate.ToString());
            ////}

            //while (oeGet.MoreResults)
            //{
            //    Console.WriteLine("Continue Retrieve Filtered ListSubscribers with GetMoreResults");
            //    oeGet = oe.GetMoreResults();
            //    Console.WriteLine("Get Status: " + oeGet.Status.ToString());
            //    Console.WriteLine("Message: " + oeGet.Message.ToString());
            //    Console.WriteLine("Code: " + oeGet.Code.ToString());
            //    Console.WriteLine("Results Length: " + oeGet.Results.Length);
            //    Console.WriteLine("MoreResults: " + oeGet.MoreResults.ToString());
            //}


            //The following request could potentially bring back large amounts of data if run against a production account	
            //Console.WriteLine("Retrieve All ListSubscribers with GetMoreResults");
            //ET_ListSubscriber oe = new ET_ListSubscriber();
            //oe.authStub = myclient;
            //oe.props = new string[] { "SendID", "SubscriberKey", "EventDate", "Client.ID", "EventType", "BatchID", "TriggeredSendDefinitionObjectID", "PartnerKey" };
            //GetResponse oeGetAll = oe.Get();

            //Console.WriteLine("Get Status: " + oeGetAll.Status.ToString());
            //Console.WriteLine("Message: " + oeGetAll.Message.ToString());
            //Console.WriteLine("Code: " + oeGetAll.Code.ToString());
            //Console.WriteLine("Results Length: " + oeGetAll.Results.Length);
            //Console.WriteLine("MoreResults: " + oeGetAll.MoreResults.ToString());
            //// Since this could potentially return a large number of results, we do not want to print the results
            ////foreach (ET_ListSubscriber ListSubscriber in oeGet.Results)
            ////{
            ////    Console.WriteLine("SubscriberKey: " + ListSubscriber.SubscriberKey + ", EventDate: " + ListSubscriber.EventDate.ToString());
            ////}

            //while (oeGetAll.MoreResults)
            //{
            //    oeGetAll = oe.GetMoreResults();
            //    Console.WriteLine("Get Status: " + oeGetAll.Status.ToString());
            //    Console.WriteLine("Message: " + oeGetAll.Message.ToString());
            //    Console.WriteLine("Code: " + oeGetAll.Code.ToString());
            //    Console.WriteLine("Results Length: " + oeGetAll.Results.Length);
            //    Console.WriteLine("MoreResults: " + oeGetAll.MoreResults.ToString());
            //}
        }
        // ------------------------------------------------------------
        // Name: UpdateConvertedProspects
        // Abstract: Retrieve subscribers from a list
        // ------------------------------------------------------------
        public static void SetPublicationListBooleans()
        {
            Dictionary<string, string> dctNewsletterListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDENewsletterSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctRemindersListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDERemindersSubscribers = new Dictionary<string, string>();

            List<string> alstrValidSubscriberKeys = new List<string>();

            try
            {
                string strSubscriberKey = "";
                string strStatus = "";
                string strDEStatus = "";
                int intUpdateRecordCount = 0;
                int intResults = 0;
                string x;

                // Data
                DateTime dtmCreatedDate = DateTime.Now;


                // Newsletter Publication List
                // Get subscriber dates
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = m_etcTDClient;
                getListSub.Props = new string[] { "SubscriberKey", "Status", "CreatedDate" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "2726" } };
                GetReturn getLSResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getLSResponse.Status.ToString());
                Console.WriteLine("Message: " + getLSResponse.Message.ToString());
                Console.WriteLine("Code: " + getLSResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getLSResponse.Results.Length);
                intResults = getLSResponse.Results.Length;

                // Get all subscriber keys associated with active subscribers
                while (getLSResponse.MoreResults == true || intResults > 0)
                {
                    foreach (ET_List_Subscriber sub in getLSResponse.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctNewsletterListSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added Subscriber: " + sub.SubscriberKey + " Status: " + strStatus);

                    }

                    getLSResponse = getListSub.GetMoreResults();
                    intResults = getLSResponse.Results.Length;
                }

                Console.WriteLine("Retrieved Newsletter List Subscription Status");

                // Get all customers and their 'NewsletterPublicationList' field from CustomerBaseDatabase
                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGetNewsletter = new ET_DataExtensionRow();
                deRowGetNewsletter.AuthStub = m_etcTDClientShared;
                deRowGetNewsletter.DataExtensionName = "CustomerDatabase";
                deRowGetNewsletter.Props = new string[] { "SubscriberKey", "NewsletterPublicationList" };
                GetReturn grRowNewsletter = deRowGetNewsletter.Get();
                Console.WriteLine("Get Status: " + grRowNewsletter.Status.ToString());
                Console.WriteLine("Message: " + grRowNewsletter.Message.ToString());
                Console.WriteLine("Code: " + grRowNewsletter.Code.ToString());
                Console.WriteLine("Results Length: " + grRowNewsletter.Results.Length);
                intResults = grRowNewsletter.Results.Length;

                while (grRowNewsletter.MoreResults == true || intResults > 0)
                {
                    foreach (ET_DataExtensionRow column in grRowNewsletter.Results)
                    {
                        strSubscriberKey = column.ColumnValues["SubscriberKey"];
                        strStatus = column.ColumnValues["NewsletterPublicationList"];

                        if (dctNewsletterListSubscribers.TryGetValue(strSubscriberKey, out x) == true)
                        {
                            dctDENewsletterSubscribers.Add(strSubscriberKey, strStatus);
                            Console.WriteLine("Added NPL customer: " + strSubscriberKey);
                        }

                    }

                    grRowNewsletter = deRowGetNewsletter.GetMoreResults();
                    intResults = grRowNewsletter.Results.Length;
                }

                // Update statuses
                ET_DataExtensionRow deRowPatchNewsletter = null;
                foreach (KeyValuePair<string, string> entry in dctDENewsletterSubscribers)
                {
                    strSubscriberKey = entry.Key;
                    strDEStatus = entry.Value;

                    // if our status = active, set to true
                    strStatus = dctNewsletterListSubscribers[strSubscriberKey];
                    if (strStatus.Equals("Active") == true)
                    {
                        strStatus = "True";
                    }
                    else
                    {
                        strStatus = "False";
                    }

                    // Is the status of our subscriber the same on the All Subscribers list as it is on the Data Extension?
                    if (strDEStatus.Equals(strStatus) == false)
                    {
                        intUpdateRecordCount += 1;
                        // No, update the verified email field
                        deRowPatchNewsletter = new ET_DataExtensionRow();
                        deRowPatchNewsletter.AuthStub = m_etcTDClientShared;
                        deRowPatchNewsletter.DataExtensionCustomerKey = "CustomerDBKey";
                        deRowPatchNewsletter.ColumnValues.Add("SubscriberKey", strSubscriberKey);
                        deRowPatchNewsletter.ColumnValues.Add("NewsletterPublicationList", strStatus);
                        PatchReturn patchRowResponse = deRowPatchNewsletter.Patch();
                        Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                        Console.WriteLine("Count: " + intUpdateRecordCount.ToString());
                        Console.WriteLine("Changed newsletter boolean for subscriber: " + strSubscriberKey + " from " + strDEStatus + " to " + strStatus);
                    }
                }
                
                Console.WriteLine("Completed Newsletter Boolean Update");

                // Reminders Publication List
                // Get subscriber dates
                ET_List_Subscriber getListSubReminders = new ET_List_Subscriber();
                getListSubReminders.AuthStub = m_etcTDClient;
                getListSubReminders.Props = new string[] { "SubscriberKey", "Status", "CreatedDate" };
                getListSubReminders.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "2727" } };
                GetReturn getLSResponseReminders = getListSubReminders.Get();
                Console.WriteLine("Get Status: " + getLSResponseReminders.Status.ToString());
                Console.WriteLine("Message: " + getLSResponseReminders.Message.ToString());
                Console.WriteLine("Code: " + getLSResponseReminders.Code.ToString());
                Console.WriteLine("Results Length: " + getLSResponseReminders.Results.Length);
                intResults = getLSResponseReminders.Results.Length;

                // Get all subscriber keys associated with active subscribers
                while (getLSResponseReminders.MoreResults == true || intResults > 0)
                {
                    foreach (ET_List_Subscriber sub in getLSResponseReminders.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctRemindersListSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added Subscriber: " + sub.SubscriberKey + " Status: " + strStatus);

                    }

                    getLSResponseReminders = getListSubReminders.GetMoreResults();
                    intResults = getLSResponseReminders.Results.Length;
                }

                Console.WriteLine("Retrieved Reminders List Subscription Status");

                // Get all customers and their 'ReminderssPublicationList' field from CustomerBaseDatabase
                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGetReminders = new ET_DataExtensionRow();
                deRowGetReminders.AuthStub = m_etcTDClientShared;
                deRowGetReminders.DataExtensionName = "CustomerDatabase";
                deRowGetReminders.Props = new string[] { "SubscriberKey", "RemindersPublicationList" };
                GetReturn grRowReminders = deRowGetReminders.Get();
                Console.WriteLine("Get Status: " + grRowReminders.Status.ToString());
                Console.WriteLine("Message: " + grRowReminders.Message.ToString());
                Console.WriteLine("Code: " + grRowReminders.Code.ToString());
                Console.WriteLine("Results Length: " + grRowReminders.Results.Length);
                intResults = grRowReminders.Results.Length;

                while (grRowReminders.MoreResults == true || intResults > 0)
                {
                    foreach (ET_DataExtensionRow column in grRowReminders.Results)
                    {
                        strSubscriberKey = column.ColumnValues["SubscriberKey"];
                        strStatus = column.ColumnValues["RemindersPublicationList"];

                        if (dctRemindersListSubscribers.TryGetValue(strSubscriberKey, out x) == true)
                        {
                            dctDERemindersSubscribers.Add(strSubscriberKey, strStatus);
                            Console.WriteLine("Added RPL customer: " + strSubscriberKey);
                        }

                    }

                    grRowReminders = deRowGetReminders.GetMoreResults();
                    intResults = grRowReminders.Results.Length;
                }

                intUpdateRecordCount = 0;

                // Update statuses
                ET_DataExtensionRow deRowPatchReminders = null;
                foreach (KeyValuePair<string, string> entry in dctDERemindersSubscribers)
                {
                    strSubscriberKey = entry.Key;
                    strDEStatus = entry.Value;


                    // if our status = active, set to true
                    strStatus = dctRemindersListSubscribers[strSubscriberKey];
                    if (strStatus.Equals("Active") == true)
                    {
                        strStatus = "True";
                    }
                    else
                    {
                        strStatus = "False";
                    }

                    // Is the status of our subscriber the same on the All Subscribers list as it is on the Data Extension?
                    if (strDEStatus.Equals(strStatus) == false)
                    {
                        intUpdateRecordCount += 1;
                        // No, update the verified email field
                        deRowPatchReminders = new ET_DataExtensionRow();
                        deRowPatchReminders.AuthStub = m_etcTDClientShared;
                        deRowPatchReminders.DataExtensionCustomerKey = "CustomerDBKey";
                        deRowPatchReminders.ColumnValues.Add("SubscriberKey", strSubscriberKey);
                        deRowPatchReminders.ColumnValues.Add("RemindersPublicationList", strStatus);
                        PatchReturn patchRowResponse = deRowPatchReminders.Patch();
                        Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                        Console.WriteLine("Count: " + intUpdateRecordCount.ToString());
                        Console.WriteLine("Changed reminders boolean for subscriber: " + strSubscriberKey + " from " + strDEStatus + " to " + strStatus);
                    }
                }

                Console.WriteLine("Completed Reminders Boolean Update");
            }
            catch (Exception excError)
            {
                // Display Error
                Console.WriteLine("Error: " + excError.ToString());
            }
        }
        // ------------------------------------------------------------
        // Name: PrepareListForCSV
        // Abstract: Prepare a list to be used to create a CSV
        // ------------------------------------------------------------
        public static Dictionary<string, string> PrepareListForCSV(String strListID)
        {
            Dictionary<string, string> dctListSubscribers = new Dictionary<string, string>();

            try
            {
                String strStatus = "";

                // Newsletter Publication List
                // Get subscriber dates
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = m_etcTDClient;
                getListSub.Props = new string[] { "SubscriberKey", "Status" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { strListID } };
                GetReturn getLSResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getLSResponse.Status.ToString());
                Console.WriteLine("Message: " + getLSResponse.Message.ToString());
                Console.WriteLine("Code: " + getLSResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getLSResponse.Results.Length);
                int intResults = getLSResponse.Results.Length;

                // CREATE HEADERS: "Subscriber Key" & "Status"

                // Get all subscriber keys associated with active subscribers
                while (getLSResponse.MoreResults == true || intResults > 0)
                {
                    foreach (ET_List_Subscriber sub in getLSResponse.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctListSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added Subscriber: " + sub.SubscriberKey + " Status: " + strStatus);
                    }

                    getLSResponse = getListSub.GetMoreResults();
                    intResults = getLSResponse.Results.Length;
                }

                Console.WriteLine("Retrieved List Subscriber Statuses from ListID: " + strListID);

            }
            catch (Exception excError)
            {
                // Display Error
                Console.WriteLine("Error: " + excError.ToString());
            }

            return dctListSubscribers;
        }
        // ------------------------------------------------------------
        // Name: RetrieveSubscribersFromList
        // Abstract: Retrieve subscribers from a list
        // ------------------------------------------------------------
        public static Dictionary<string, string> RetrieveSubscribersFromList()
        {
            Dictionary<string, string> dctSubscribers = new Dictionary<string, string>();

            try
            {
                int intIndex = 0;
                string strSubscriberKey = "";

                Console.WriteLine("\n Retrieve all Subscribers on the List");
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = m_etcTDClient;
                getListSub.Props = new string[] { "ObjectID", "SubscriberKey", "CreatedDate", "Client.ID", "Client.PartnerClientKey", "ListID", "Status" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "3075" } };
                GetReturn getResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getResponse.Status.ToString());
                Console.WriteLine("Message: " + getResponse.Message.ToString());
                Console.WriteLine("Code: " + getResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getResponse.Results.Length);

                ET_Subscriber getSub = new ET_Subscriber();
                getSub.AuthStub = m_etcTDClient;
                getSub.Props = new string[] { "SubscriberKey", "EmailAddress", "Status" };

                // Loop through subscribers on the list and add their keys to our array
                foreach (ET_List_Subscriber ResultListSub in getResponse.Results)
                {
                    // Subscriber Key
                    strSubscriberKey = ResultListSub.SubscriberKey;

                    // Get information on that subscriber
                    getSub.SearchFilter = new SimpleFilterPart() { Property = "SubscriberKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { strSubscriberKey } };
                    GetReturn getSubResponse = getSub.Get();

                    foreach (ET_Subscriber sub in getSubResponse.Results)
                    {
                        if (dctSubscribers.TryGetValue(sub.EmailAddress.ToUpper(), out strSubscriberKey) == false && dctSubscribers.ContainsKey(sub.EmailAddress.ToUpper()) == false)
                        {
                            intIndex += 1;
                            if (intIndex == 1323)
                            {
                                Console.WriteLine("EHY");
                            }
                            dctSubscribers.Add(sub.EmailAddress.ToUpper(), ResultListSub.SubscriberKey);
                            Console.WriteLine("Count: " + intIndex.ToString() + "; Subscriber Key: " + ResultListSub.SubscriberKey);
                        }
                    }
                }



            }
            catch (Exception excError)
            {
                // Display Error
                Console.WriteLine("Error: " + excError.ToString());
            }

            return dctSubscribers;
        }