Esempio n. 1
0
        public PostReturnStatus CreateDataExtension(string name, string customerKey, string primaryColumnName)
        {
            ET_DataExtension postDataExtension = new ET_DataExtension();

            postDataExtension.AuthStub    = _etClient;
            postDataExtension.Name        = name;
            postDataExtension.CustomerKey = customerKey;
            ET_DataExtensionColumn nameColumn = new ET_DataExtensionColumn()
            {
                Name = primaryColumnName, FieldType = DataExtensionFieldType.Text, IsPrimaryKey = true, MaxLength = 100, IsRequired = true
            };

            postDataExtension.Columns = new ET_DataExtensionColumn[] { nameColumn };
            PostReturn postResponse = postDataExtension.Post();

            PostReturnStatus status = new PostReturnStatus()
            {
                Status        = postResponse.Status.ToString(),
                Message       = postResponse.Message.ToString(),
                Code          = postResponse.Code.ToString(),
                ResultsLength = postResponse.Results.Length
            };

            return(status);
        }
        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());
            }
        }
Esempio n. 3
0
        public PostReturnStatus AddDataRowToDataExtension(string customerKey, List <KeyValuePair <string, string> > columnValues)
        {
            ET_DataExtensionRow deRowPost = new ET_DataExtensionRow();

            deRowPost.AuthStub = _etClient;
            deRowPost.DataExtensionCustomerKey = customerKey;

            foreach (KeyValuePair <string, string> kv in columnValues)
            {
                deRowPost.ColumnValues.Add(kv.Key, kv.Value);
            }

            PostReturn prRowResponse = deRowPost.Post();

            return
                (new PostReturnStatus()
            {
                Status = prRowResponse.Status.ToString(),
                Message = prRowResponse.Message.ToString(),
                Code = prRowResponse.Code.ToString(),
                ResultsLength = prRowResponse.Results.Length
            });
        }
Esempio n. 4
0
        public string CreateEmail(string name, string customerKey, string description, string subject, string htmlBody)
        {
            try
            {
                string emailCustomerKey = Guid.NewGuid().ToString();
                //ET_Email delEmail = new ET_Email();
                //delEmail.CustomerKey = emailCustomerKey;
                //delEmail.AuthStub = _etClient;
                //DeleteReturn deleteResponse = delEmail.Delete();

                ET_Email email = new ET_Email();
                //email.ID = emailIDForSendDefinition;
                email.AuthStub    = _etClient;
                email.Name        = name;
                email.CustomerKey = emailCustomerKey;
                email.Subject     = subject;
                email.HTMLBody    = htmlBody;
                email.EmailType   = "HTML";
                email.IsHTMLPaste = true;

                PostReturn postResponse = email.Post();

                if (postResponse.Status)
                {
                    return(emailCustomerKey);
                }
                else
                {
                    return(string.Empty);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 5
0
        static void TestET_Folder()
        {
            string NewFolderName    = "Testing C Sharp SDK";
            int    ParentIDForEmail = 0;
            string ContentType      = "email";

            ET_Client myclient = new ET_Client();

            Console.WriteLine("--- Testing Folder ---");

            Console.WriteLine("\n Retrieve All Folder with GetMoreResults");
            ET_Folder getAllFolder = new ET_Folder();

            getAllFolder.AuthStub = myclient;
            getAllFolder.Props    = new string[] { "ID", "Client.ID", "ParentFolder.ID", "ParentFolder.CustomerKey", "ParentFolder.ObjectID", "ParentFolder.Name", "ParentFolder.Description", "ParentFolder.ContentType", "ParentFolder.IsActive", "ParentFolder.IsEditable", "ParentFolder.AllowChildren", "Name", "Description", "ContentType", "IsActive", "IsEditable", "AllowChildren", "CreatedDate", "ModifiedDate", "Client.ModifiedBy", "ObjectID", "CustomerKey", "Client.EnterpriseID", "Client.CreatedBy" };
            GetReturn grAllFolder = getAllFolder.Get();

            Console.WriteLine("Get Status: " + grAllFolder.Status.ToString());
            Console.WriteLine("Message: " + grAllFolder.Message.ToString());
            Console.WriteLine("Code: " + grAllFolder.Code.ToString());
            Console.WriteLine("Results Length: " + grAllFolder.Results.Length);

            while (grAllFolder.MoreResults)
            {
                Console.WriteLine("\n Continue Retrieve All Folders with GetMoreResults");
                grAllFolder = getAllFolder.GetMoreResults();
                Console.WriteLine("Get Status: " + grAllFolder.Status.ToString());
                Console.WriteLine("Message: " + grAllFolder.Message.ToString());
                Console.WriteLine("Code: " + grAllFolder.Code.ToString());
                Console.WriteLine("Results Length: " + grAllFolder.Results.Length);
            }


            Console.WriteLine("\n Retrieve Specific Folder for Email Folder ParentID");
            ET_Folder getFolder = new ET_Folder();

            getFolder.AuthStub = myclient;
            SimpleFilterPart ParentFolderFilter = new SimpleFilterPart()
            {
                Property = "ParentFolder.ID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "0" }
            };
            SimpleFilterPart ContentTypeFilter = new SimpleFilterPart()
            {
                Property = "ContentType", SimpleOperator = SimpleOperators.equals, Value = new string[] { "Email" }
            };

            getFolder.SearchFilter = new ComplexFilterPart()
            {
                LeftOperand = ParentFolderFilter, RightOperand = ContentTypeFilter, LogicalOperator = LogicalOperators.AND
            };
            getFolder.Props = new string[] { "ID", "Name", "Description" };
            GetReturn grFolder = getFolder.Get();

            Console.WriteLine("Get Status: " + grFolder.Status.ToString());
            Console.WriteLine("Message: " + grFolder.Message.ToString());
            Console.WriteLine("Code: " + grFolder.Code.ToString());
            Console.WriteLine("Results Length: " + grFolder.Results.Length);

            foreach (ET_Folder ef in grFolder.Results)
            {
                ParentIDForEmail = ef.ID;
            }


            if (ParentIDForEmail != 0)
            {
                Console.WriteLine("\n Create Folder");
                ET_Folder fold = new ET_Folder();
                fold.Name            = NewFolderName;
                fold.Description     = NewFolderName;
                fold.CustomerKey     = NewFolderName;
                fold.AuthStub        = myclient;
                fold.ParentFolder    = new ET_Folder();
                fold.ParentFolder.ID = ParentIDForEmail;
                fold.ContentType     = ContentType;
                fold.IsEditable      = true;
                PostReturn prFolder = fold.Post();

                Console.WriteLine("Post Status: " + prFolder.Status.ToString());
                Console.WriteLine("Message: " + prFolder.Message.ToString());
                Console.WriteLine("Code: " + prFolder.Code.ToString());
                Console.WriteLine("Results Length: " + prFolder.Results.Length);

                foreach (ResultDetail rd in prFolder.Results)
                {
                    Console.WriteLine("--Status Code: " + rd.StatusCode);
                    Console.WriteLine("--Status Message: " + rd.StatusMessage);
                }

                Console.WriteLine("\n Retrieve newly created Folder");
                ET_Folder getNewFolder = new ET_Folder();
                getNewFolder.AuthStub     = myclient;
                getNewFolder.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { NewFolderName }
                };
                getNewFolder.Props = new string[] { "ID", "Name", "Description" };
                GetReturn grNewFolder = getNewFolder.Get();

                Console.WriteLine("Get Status: " + grNewFolder.Status.ToString());
                Console.WriteLine("Message: " + grFolder.Message.ToString());
                Console.WriteLine("Code: " + grNewFolder.Code.ToString());
                Console.WriteLine("Results Length: " + grNewFolder.Results.Length);

                foreach (ET_Folder ef in grNewFolder.Results)
                {
                    Console.WriteLine("--Name: " + ef.Name + " - Description:" + ef.Description);
                }

                Console.WriteLine("\n UpdateFolder");
                ET_Folder patchFolder = new ET_Folder();
                patchFolder.AuthStub    = myclient;
                patchFolder.CustomerKey = NewFolderName;
                patchFolder.Description = "Now with a new Description";
                PatchReturn patchResponse = patchFolder.Patch();

                Console.WriteLine("Patch Status: " + patchResponse.Status.ToString());
                Console.WriteLine("Message: " + patchResponse.Message.ToString());
                Console.WriteLine("Code: " + patchResponse.Code.ToString());
                Console.WriteLine("Results Length: " + patchResponse.Results.Length);

                if (patchResponse.Status)
                {
                    Console.WriteLine("\n Retrieve updated Folder");
                    grNewFolder = getNewFolder.Get();

                    Console.WriteLine("Get Status: " + grNewFolder.Status.ToString());
                    Console.WriteLine("Message: " + grFolder.Message.ToString());
                    Console.WriteLine("Code: " + grNewFolder.Code.ToString());
                    Console.WriteLine("Results Length: " + grNewFolder.Results.Length);

                    foreach (ET_Folder ef in grNewFolder.Results)
                    {
                        Console.WriteLine("--Name: " + ef.Name + " - Description:" + ef.Description);
                    }
                }

                Console.WriteLine("\n Delete Folder");
                ET_Folder delFolder = new ET_Folder();
                delFolder.AuthStub    = myclient;
                delFolder.CustomerKey = NewFolderName;
                FuelSDK.DeleteReturn drFolder = delFolder.Delete();
                Console.WriteLine("Delete Status: " + drFolder.Status.ToString());
                Console.WriteLine("Message: " + drFolder.Message.ToString());
                Console.WriteLine("Code: " + drFolder.Code.ToString());
                Console.WriteLine("Results Length: " + drFolder.Results.Length);

                foreach (ResultDetail rd in drFolder.Results)
                {
                    Console.WriteLine("--Status Code: " + rd.StatusCode);
                    Console.WriteLine("--Status Message: " + rd.StatusMessage);
                }

                Console.WriteLine("\n Retrieve Folder to confirm deletion");
                grNewFolder = getNewFolder.Get();

                Console.WriteLine("Get Status: " + grNewFolder.Status.ToString());
                Console.WriteLine("Message: " + grFolder.Message.ToString());
                Console.WriteLine("Code: " + grNewFolder.Code.ToString());
                Console.WriteLine("Results Length: " + grNewFolder.Results.Length);

                foreach (ET_Folder ef in grNewFolder.Results)
                {
                    Console.WriteLine("--Name: " + ef.Name + " - Description:" + ef.Description);
                }
            }
        }
Esempio n. 6
0
        private void RetrieveSubscribers()
        {
            List <int> lstListIDs = new List <int>();

            lstListIDs.Add(17942355);
            lstListIDs.Add(17942350);
            lstListIDs.Add(17942353);
            lstListIDs.Add(17942356);
            lstListIDs.Add(17942359);
            lstListIDs.Add(17942361);

            dtSubscribers = new DataTable();
            dtSubscribers.Columns.Add("SubscriberID");
            dtSubscribers.Columns.Add("EmailAddress");
            dtSubscribers.Columns.Add("ListID");
            dtSubscribers.Columns.Add("DateAdded");
            dtSubscribers.Columns.Add("DateModified");

            NameValueCollection parameters = new NameValueCollection();

            parameters.Add("clientId", "3uqagf2nrt2mm27q3rt45ett");
            parameters.Add("clientSecret", "D5wxtEx6UGNVxgkbyrruJhQV");

            ET_Client myclient = new ET_Client(parameters);
            ET_List   postList = new ET_List();


            postList.AuthStub = myclient;
            PostReturn prList = postList.Post();

            if (prList.Status && prList.Results.Length > 0)
            {
                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();
                foreach (int newListID in lstListIDs)
                {
                    try
                    {
                        getListSub.SearchFilter = new SimpleFilterPart()
                        {
                            Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { newListID.ToString() }
                        };
                        GetReturn response = getListSub.Get();
                        foreach (ET_List_Subscriber subscriber in response.Results)
                        {
                            try
                            {
                                DataRow dr = dtSubscribers.NewRow();
                                dr["SubscriberID"] = subscriber.ID.ToString();
                                dr["ListID"]       = subscriber.ListID.ToString();
                                dr["EmailAddress"] = subscriber.SubscriberKey.ToString();
                                dr["DateAdded"]    = subscriber.CreatedDate.ToString();
                                dr["DateModified"] = subscriber.ModifiedDate.ToString();
                                dtSubscribers.Rows.Add(dr);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            if (dtSubscribers.Rows.Count > 0)
            {
                //Save All Subscribers to the database
                foreach (DataRow scribe in dtSubscribers.Rows)
                {
                    try
                    {
                        string spName           = "dbo.AddETSubscriber";
                        String ConnectionString = Sitecore.Configuration.Settings.GetConnectionString("custom");
                        if (!String.IsNullOrWhiteSpace(ConnectionString))
                        {
                            using (SqlConnection connection = new SqlConnection(ConnectionString))
                            {
                                using (SqlCommand command = new SqlCommand(spName, connection))
                                {
                                    command.CommandType = CommandType.StoredProcedure;
                                    connection.Open();

                                    command.Parameters.Add(new SqlParameter("@SubscriberID", scribe["SubscriberID"].ToString()));
                                    command.Parameters.Add(new SqlParameter("@ListID", scribe["ListID"].ToString()));
                                    command.Parameters.Add(new SqlParameter("@EmailAddress", scribe["EmailAddress"].ToString()));
                                    command.Parameters.Add(new SqlParameter("@DateSubscriptionAdded", scribe["DateAdded"].ToString()));
                                    command.Parameters.Add(new SqlParameter("@DateSubscriptionUpdated", scribe["DateModified"].ToString()));
                                    command.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
        static void TestET_DataExtension()
        {
            ET_Client myclient = new ET_Client();

            string NameOfTestDataExtension = "CSharpCreatedDE";

            Console.WriteLine("--- Testing DataExtension ---");
            Console.WriteLine("\n Get all of the DataExtensions in an Account");
            ET_DataExtension getAllDataExtension = new ET_DataExtension();

            getAllDataExtension.AuthStub = myclient;
            getAllDataExtension.Props    = new string[] { "CustomerKey", "Name" };
            GetReturn grAllDataExtension = getAllDataExtension.Get();

            Console.WriteLine("Get Status: " + grAllDataExtension.Status.ToString());
            Console.WriteLine("Message: " + grAllDataExtension.Message.ToString());
            Console.WriteLine("Code: " + grAllDataExtension.Code.ToString());
            Console.WriteLine("Results Length: " + grAllDataExtension.Results.Length);

            while (grAllDataExtension.MoreResults)
            {
                Console.WriteLine("\n Continue Retrieve All DataExtension with GetMoreResults");
                grAllDataExtension = getAllDataExtension.GetMoreResults();
                Console.WriteLine("Get Status: " + grAllDataExtension.Status.ToString());
                Console.WriteLine("Message: " + grAllDataExtension.Message.ToString());
                Console.WriteLine("Code: " + grAllDataExtension.Code.ToString());
                Console.WriteLine("Results Length: " + grAllDataExtension.Results.Length);
            }



            Console.WriteLine("\n Create DataExtension");
            ET_DataExtension postDataExtension = new ET_DataExtension();

            postDataExtension.AuthStub    = myclient;
            postDataExtension.Name        = NameOfTestDataExtension;
            postDataExtension.CustomerKey = NameOfTestDataExtension;
            ET_DataExtensionColumn nameColumn = new ET_DataExtensionColumn()
            {
                Name = "Name", FieldType = DataExtensionFieldType.Text, IsPrimaryKey = true, MaxLength = 100, IsRequired = true
            };
            ET_DataExtensionColumn otherColumn = new ET_DataExtensionColumn()
            {
                Name = "OtherColumn", FieldType = DataExtensionFieldType.Text
            };

            postDataExtension.Columns = new ET_DataExtensionColumn[] { nameColumn, otherColumn };
            PostReturn postResponse = postDataExtension.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)
            {
                Console.WriteLine("\n Update DE to add new field");
                ET_DataExtension patchDataExtension = new ET_DataExtension();
                patchDataExtension.AuthStub    = myclient;
                patchDataExtension.CustomerKey = NameOfTestDataExtension;
                ET_DataExtensionColumn addedField = new ET_DataExtensionColumn()
                {
                    Name = "AddedField", FieldType = DataExtensionFieldType.Text
                };
                patchDataExtension.Columns = new ET_DataExtensionColumn[] { addedField };
                FuelSDK.PatchReturn patchFR = patchDataExtension.Patch();
                Console.WriteLine("Patch Status: " + patchFR.Status.ToString());
                Console.WriteLine("Message: " + patchFR.Message.ToString());
                Console.WriteLine("Code: " + patchFR.Code.ToString());
                Console.WriteLine("Results Length: " + patchFR.Results.Length);

                Console.WriteLine("\n Retrieve All Columns for a data extension");
                ET_DataExtensionColumn getColumn = new ET_DataExtensionColumn();
                getColumn.AuthStub     = myclient;
                getColumn.Props        = new string[] { "Name", "FieldType" };
                getColumn.SearchFilter = new SimpleFilterPart()
                {
                    Property = "DataExtension.CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { NameOfTestDataExtension }
                };
                GetReturn getColumnResponse = getColumn.Get();
                Console.WriteLine("Get Status: " + getColumnResponse.Status.ToString());
                Console.WriteLine("Message: " + getColumnResponse.Message.ToString());
                Console.WriteLine("Code: " + getColumnResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getColumnResponse.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionColumn column in getColumnResponse.Results)
                    {
                        Console.WriteLine("-- Name: " + column.Name + "  Type: " + column.FieldType.ToString());
                    }
                }

                Console.WriteLine("\n Add a row to a data extension (using CustomerKey)");
                ET_DataExtensionRow deRowPost = new ET_DataExtensionRow();
                deRowPost.AuthStub = myclient;
                deRowPost.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowPost.ColumnValues.Add("Name", "Example Name");
                deRowPost.ColumnValues.Add("OtherColumn", "Different Example Text");
                PostReturn prRowResponse = deRowPost.Post();
                Console.WriteLine("Post Status: " + prRowResponse.Status.ToString());
                Console.WriteLine("Message: " + prRowResponse.Message.ToString());
                Console.WriteLine("Code: " + prRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + prRowResponse.Results.Length);

                Console.WriteLine("\n Add a row to a data extension (using Name)");
                ET_DataExtensionRow deRowPost2 = new ET_DataExtensionRow();
                deRowPost2.AuthStub          = myclient;
                deRowPost2.DataExtensionName = NameOfTestDataExtension;
                deRowPost2.ColumnValues.Add("Name", "Example Name3");
                deRowPost2.ColumnValues.Add("OtherColumn", "Different Example Text");
                PostReturn prRowResponse2 = deRowPost2.Post();
                Console.WriteLine("Post Status: " + prRowResponse2.Status.ToString());
                Console.WriteLine("Message: " + prRowResponse2.Message.ToString());
                Console.WriteLine("Code: " + prRowResponse2.Code.ToString());
                Console.WriteLine("Results Length: " + prRowResponse2.Results.Length);

                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGet = new ET_DataExtensionRow();
                deRowGet.AuthStub          = myclient;
                deRowGet.DataExtensionName = NameOfTestDataExtension;
                deRowGet.Props             = new string[] { "Name", "OtherColumn" };
                GetReturn grRow = deRowGet.Get();
                Console.WriteLine("Post Status: " + grRow.Status.ToString());
                Console.WriteLine("Message: " + grRow.Message.ToString());
                Console.WriteLine("Code: " + grRow.Code.ToString());
                Console.WriteLine("Results Length: " + grRow.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionRow column in grRow.Results)
                    {
                        Console.WriteLine("--Name: " + column.ColumnValues["Name"] + " - OtherColumn: " + column.ColumnValues["OtherColumn"]);
                    }
                }

                Console.WriteLine("\n Update a row in  a data extension");
                ET_DataExtensionRow deRowPatch = new ET_DataExtensionRow();
                deRowPatch.AuthStub = myclient;
                deRowPatch.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowPatch.ColumnValues.Add("Name", "Example Name");
                deRowPatch.ColumnValues.Add("OtherColumn", "New Value for First Column");
                PatchReturn patchRowResponse = deRowPatch.Patch();
                Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                Console.WriteLine("Message: " + patchRowResponse.Message.ToString());
                Console.WriteLine("Code: " + patchRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + patchRowResponse.Results.Length);

                Console.WriteLine("\n Retrieve only updated row");
                ET_DataExtensionRow deRowGetSingle = new ET_DataExtensionRow();
                deRowGetSingle.AuthStub          = myclient;
                deRowGetSingle.DataExtensionName = NameOfTestDataExtension;
                deRowGetSingle.Props             = new string[] { "Name", "OtherColumn" };
                deRowGetSingle.SearchFilter      = new SimpleFilterPart()
                {
                    Property = "Name", SimpleOperator = SimpleOperators.equals, Value = new string[] { "Example Name" }
                };
                GetReturn grSingleRow = deRowGetSingle.Get();
                Console.WriteLine("Post Status: " + grSingleRow.Status.ToString());
                Console.WriteLine("Message: " + grSingleRow.Message.ToString());
                Console.WriteLine("Code: " + grSingleRow.Code.ToString());
                Console.WriteLine("Results Length: " + grSingleRow.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionRow column in grSingleRow.Results)
                    {
                        Console.WriteLine("--Name: " + column.ColumnValues["Name"] + " - OtherColumn: " + column.ColumnValues["OtherColumn"]);
                    }
                }

                Console.WriteLine("\n Delete a row from a data extension)");
                ET_DataExtensionRow deRowDelete = new ET_DataExtensionRow();
                deRowDelete.AuthStub = myclient;
                deRowDelete.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowDelete.ColumnValues.Add("Name", "Example Name");
                DeleteReturn drRowResponse = deRowDelete.Delete();
                Console.WriteLine("Post Status: " + drRowResponse.Status.ToString());
                Console.WriteLine("Message: " + drRowResponse.Message.ToString());
                Console.WriteLine("Code: " + drRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + drRowResponse.Results.Length);


                Console.WriteLine("\n Delete DataExtension");
                ET_DataExtension delDataExtension = new ET_DataExtension();
                delDataExtension.CustomerKey = NameOfTestDataExtension;
                delDataExtension.AuthStub    = myclient;
                DeleteReturn deleteResponse = delDataExtension.Delete();
                Console.WriteLine("Delete Status: " + deleteResponse.Status.ToString());
                Console.WriteLine("Message: " + deleteResponse.Message.ToString());
                Console.WriteLine("Code: " + deleteResponse.Code.ToString());
                Console.WriteLine("Results Length: " + deleteResponse.Results.Length);

                Console.WriteLine("\n Info DataExtension");
                ET_DataExtension DataExtensionInfo = new ET_DataExtension();
                DataExtensionInfo.AuthStub = myclient;
                InfoReturn info = DataExtensionInfo.Info();
                Console.WriteLine("Info Status: " + info.Status.ToString());
                Console.WriteLine("Message: " + info.Message.ToString());
                Console.WriteLine("Code: " + info.Code.ToString());
                Console.WriteLine("Results Length: " + info.Results.Length);
                foreach (ET_PropertyDefinition def in info.Results)
                {
                    Console.WriteLine("--Name: " + def.Name + ", IsRetrievable: " + def.IsRetrievable.ToString());
                }
            }
        }
        static void TestET_Subscriber()
        {
            ET_Client myclient = new ET_Client();

            Console.WriteLine("--- Testing Subscriber ---");
            string SubscriberTestEmail = "*****@*****.**";

            Console.WriteLine("\n Create Subscriber");
            ET_Subscriber postSub = new ET_Subscriber();

            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.Results.Length > 0)
            {
                Console.WriteLine("--NewID: " + postResponse.Results[0].NewID.ToString());
                foreach (ET_ProfileAttribute attr in ((ET_Subscriber)postResponse.Results[0].Object).Attributes)
                {
                    Console.WriteLine("Name: " + attr.Name + ", Value: " + attr.Value);
                }
            }

            Console.WriteLine("\n Retrieve newly created Subscriber");
            ET_Subscriber getSub = new ET_Subscriber();

            getSub.AuthStub     = myclient;
            getSub.Props        = new string[] { "SubscriberKey", "EmailAddress", "Status" };
            getSub.SearchFilter = new SimpleFilterPart()
            {
                Property = "SubscriberKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { SubscriberTestEmail }
            };
            GetReturn getResponse = getSub.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_Subscriber sub in getResponse.Results)
            {
                Console.WriteLine("--EmailAddress: " + sub.EmailAddress + " Status: " + sub.Status.ToString());
            }


            Console.WriteLine("\n Update Subscriber");
            ET_Subscriber patchSub = new ET_Subscriber();

            patchSub.AuthStub     = myclient;
            patchSub.EmailAddress = SubscriberTestEmail;
            patchSub.Status       = SubscriberStatus.Unsubscribed;
            patchSub.Attributes   = new FuelSDK.ET_ProfileAttribute[] { new ET_ProfileAttribute()
                                                                        {
                                                                            Name = "First Name", Value = "ExactTarget Example"
                                                                        } };
            PatchReturn pathResponse = patchSub.Patch();

            Console.WriteLine("Patch Status: " + pathResponse.Status.ToString());
            Console.WriteLine("Message: " + pathResponse.Message.ToString());
            Console.WriteLine("Code: " + pathResponse.Code.ToString());
            Console.WriteLine("Results Length: " + pathResponse.Results.Length);

            foreach (ResultDetail rd in pathResponse.Results)
            {
                ET_Subscriber sub = (ET_Subscriber)rd.Object;
                Console.WriteLine("--EmailAddress: " + sub.EmailAddress + " Status: " + sub.Status.ToString());
            }

            Console.WriteLine("\n Retrieve Subscriber that should have status unsubscribed now");
            getResponse = getSub.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_Subscriber sub in getResponse.Results)
            {
                Console.WriteLine("--EmailAddress: " + sub.EmailAddress + " Status: " + sub.Status.ToString());
            }

            Console.WriteLine("\n Delete Subscriber");
            ET_Subscriber deleteSub = new ET_Subscriber();

            deleteSub.AuthStub     = myclient;
            deleteSub.EmailAddress = SubscriberTestEmail;
            DeleteReturn deleteResponse = deleteSub.Delete();

            Console.WriteLine("Delete Status: " + deleteResponse.Status.ToString());
            Console.WriteLine("Message: " + deleteResponse.Message.ToString());
            Console.WriteLine("Code: " + deleteResponse.Code.ToString());
            Console.WriteLine("Results Length: " + deleteResponse.Results.Length);

            Console.WriteLine("\n Retrieve Subscriber to confirm deletion");
            getResponse = getSub.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_Subscriber sub in getResponse.Results)
            {
                Console.WriteLine("--EmailAddress: " + sub.EmailAddress + " Status: " + sub.Status.ToString());
            }
        }
Esempio n. 9
0
        private string updateAlias(string oldValue, string newValue, string distributor)
        {
            PostReturn pr = new PostReturn();
            pr.key = oldValue;
            string strSQL = string.Format("select * from tb_page_visit_info_xango where alias = '{0}' and distributor='{1}'", newValue, distributor);
            //string strSQL = "select * from tb_page_visit_info_xango where alias = '" + newValue + "' and distributor='" + distributor + "'";
            try
            {
                using (SqlConnection sc = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlserver"].ConnectionString))
                {
                    if (sc != null)
                    {
                        DataSet ds = SqlHelper.ExecuteDataset(sc, CommandType.Text, strSQL);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                pr.message = string.Format("Alias already exists. Please enter another one.");
                                //return strRet;
                            }
                            else
                            {
                                try
                                {
                                    strSQL = string.Format("update tb_page_visit_info_xango set alias = '{0}' where alias = '{1}' and distributor='{2}'", newValue, oldValue, distributor);
                                    SqlHelper.ExecuteNonQuery(sc, CommandType.Text, strSQL);
                                    pr.success = 1;
                                }
                                catch (Exception e)
                                {
                                    AdssLogger.WriteLog("Exception in updateAlias(): " + e.Message);
                                    pr.message = "Operation failed.";
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                //Trace.WriteLine(e.Message);
                AdssLogger.WriteLog("GetSampleAnalyticsInfo(getResult) --- Exception: " + e.Message + " --- sql: " + strSQL);
                pr.message = "Operation failed.";
            }

            return new JavaScriptSerializer().Serialize(pr);
        }
Esempio n. 10
0
        static void TestET_Campaign()
        {
            ET_Client myclient              = new ET_Client();
            string    IDOfpostCampaign      = string.Empty;
            string    IDOfpostCampaignAsset = string.Empty;
            string    ExampleAssetType      = "LIST";
            string    ExampleAssetItemID    = "1953114";

            Console.WriteLine("--- Testing Campaign ---");

            Console.WriteLine("\n Retrieve All Campaigns");
            ET_Campaign getCampaign = new ET_Campaign();

            getCampaign.AuthStub = myclient;
            GetReturn grCampaign = getCampaign.Get();

            Console.WriteLine("Get Status: " + grCampaign.Status.ToString());
            Console.WriteLine("Message: " + grCampaign.Message.ToString());
            Console.WriteLine("Code: " + grCampaign.Code.ToString());
            Console.WriteLine("Results Length: " + grCampaign.Results.Length);
            Console.WriteLine("MoreResults: " + grCampaign.MoreResults.ToString());

            foreach (ET_Campaign thisCamp in grCampaign.Results)
            {
                Console.WriteLine("Name: " + thisCamp.Name + ",  ID: " + thisCamp.ID + ", Description: " + thisCamp.Description);
            }

            if (grCampaign.MoreResults)
            {
                grCampaign = getCampaign.GetMoreResults();
                Console.WriteLine("Get Status: " + grCampaign.Status.ToString());
                Console.WriteLine("Message: " + grCampaign.Message.ToString());
                Console.WriteLine("Code: " + grCampaign.Code.ToString());
                Console.WriteLine("Results Length: " + grCampaign.Results.Length);
                Console.WriteLine("MoreResults: " + grCampaign.MoreResults.ToString());

                foreach (ET_Campaign thisCamp in grCampaign.Results)
                {
                    Console.WriteLine("Name: " + thisCamp.Name + ",  ID: " + thisCamp.ID + ", Description: " + thisCamp.Description);
                }
            }


            Console.WriteLine("\n Create Campaign");
            ET_Campaign camp = new ET_Campaign();

            camp.AuthStub    = myclient;
            camp.Name        = "CSharpSDKCreatedForTEST";
            camp.Description = "CSharpSDKCreatedForTEST";

            PostReturn prCampaign = camp.Post();

            Console.WriteLine("Post Status: " + prCampaign.Status.ToString());
            Console.WriteLine("Message: " + prCampaign.Message.ToString());
            Console.WriteLine("Code: " + prCampaign.Code.ToString());
            Console.WriteLine("Results Length: " + prCampaign.Results.Length);

            if (prCampaign.Results.Length > 0)
            {
                ET_Campaign campaign = (ET_Campaign)prCampaign.Results[0].Object;
                Console.WriteLine("--ID: " + campaign.ID + ", CreatedDate: " + campaign.CreatedDate);
                IDOfpostCampaign = campaign.ID.ToString();

                Console.WriteLine("\n Retrieve the new Campaign");
                ET_Campaign singleCampaign = new ET_Campaign();
                singleCampaign.AuthStub = myclient;
                singleCampaign.ID       = campaign.ID;
                GetReturn grSingleCamp = singleCampaign.Get();

                Console.WriteLine("Get Status: " + grSingleCamp.Status.ToString());
                Console.WriteLine("Message: " + grSingleCamp.Message.ToString());
                Console.WriteLine("Code: " + grSingleCamp.Code.ToString());
                Console.WriteLine("Results Length: " + grSingleCamp.Results.Length);

                Console.WriteLine("\n Create a new Campaign Asset");
                ET_CampaignAsset postCampAsset = new ET_CampaignAsset();
                postCampAsset.AuthStub   = myclient;
                postCampAsset.CampaignID = IDOfpostCampaign;
                postCampAsset.Type       = ExampleAssetType;
                postCampAsset.IDs        = new string[] { ExampleAssetItemID };
                PostReturn prCampAsset = postCampAsset.Post();
                Console.WriteLine("Post Status: " + prCampAsset.Status.ToString());
                Console.WriteLine("Message: " + prCampAsset.Message.ToString());
                Console.WriteLine("Code: " + prCampAsset.Code.ToString());
                Console.WriteLine("Results Length: " + prCampAsset.Results.Length);

                if (prCampAsset.Status)
                {
                    IDOfpostCampaignAsset = prCampAsset.Results[0].Object.ID.ToString();

                    Console.WriteLine("\n Retrieve a single new Campaign Asset");
                    ET_CampaignAsset singleCampAsset = new ET_CampaignAsset();
                    singleCampAsset.AuthStub   = myclient;
                    singleCampAsset.ID         = Convert.ToInt16(IDOfpostCampaignAsset);
                    singleCampAsset.CampaignID = IDOfpostCampaign;
                    GetReturn grSingleCampAsset = singleCampAsset.Get();
                    Console.WriteLine("Get Status: " + grSingleCampAsset.Status.ToString());
                    Console.WriteLine("Message: " + grSingleCampAsset.Message.ToString());
                    Console.WriteLine("Code: " + grSingleCampAsset.Code.ToString());
                    Console.WriteLine("Results Length: " + grSingleCampAsset.Results.Length);


                    Console.WriteLine("\n Delete the new Campaign Asset");
                    ET_CampaignAsset deleteCampAsset = new ET_CampaignAsset();
                    deleteCampAsset.AuthStub   = myclient;
                    deleteCampAsset.ID         = Convert.ToInt16(IDOfpostCampaignAsset);
                    deleteCampAsset.CampaignID = IDOfpostCampaign;
                    DeleteReturn drSingleCampAsset = deleteCampAsset.Delete();
                    Console.WriteLine("Get Status: " + drSingleCampAsset.Status.ToString());
                    Console.WriteLine("Message: " + drSingleCampAsset.Message.ToString());
                    Console.WriteLine("Code: " + drSingleCampAsset.Code.ToString());
                    Console.WriteLine("Results Length: " + drSingleCampAsset.Results.Length);
                }

                Console.WriteLine("\n Delete Campaign");
                ET_Campaign delCampaign = new ET_Campaign();
                delCampaign.AuthStub = myclient;
                delCampaign.ID       = campaign.ID;
                DeleteReturn drCampaign = delCampaign.Delete();
                Console.WriteLine("Delete Status: " + drCampaign.Status.ToString());
                Console.WriteLine("Message: " + drCampaign.Message.ToString());
                Console.WriteLine("Code: " + drCampaign.Code.ToString());
                Console.WriteLine("Results Length: " + drCampaign.Results.Length);
            }
        }
Esempio n. 11
0
        static void TestET_List()
        {
            ET_Client myclient = new ET_Client();

            Console.WriteLine("--- Testing List ---");
            int MyNewListID = 0;

            Console.WriteLine("\n Create List");
            ET_List list = new ET_List();

            list.AuthStub    = myclient;
            list.ListName    = "C# SDK Rules!!";
            list.Description = "This is my SDK Created List";
            PostReturn postFR = list.Post();

            Console.WriteLine("Post Status: " + postFR.Status.ToString());
            Console.WriteLine("Message: " + postFR.Message.ToString());
            Console.WriteLine("Code: " + postFR.Code.ToString());
            Console.WriteLine("Results Length: " + postFR.Results.Length);

            if (postFR.Results.Length > 0)
            {
                MyNewListID = postFR.Results[0].NewID;
            }

            if (MyNewListID > 0)
            {
                Console.WriteLine("\n Retrieve newly create list");
                list.Props        = new string[] { "ID", "ListName", "Description" };
                list.SearchFilter = new SimpleFilterPart()
                {
                    Property = "ID", SimpleOperator = SimpleOperators.equals, Value = new String[] { MyNewListID.ToString() }
                };
                GetReturn getFR = list.Get();
                Console.WriteLine("Get Status: " + getFR.Status.ToString());
                Console.WriteLine("Message: " + getFR.Message.ToString());
                Console.WriteLine("Code: " + getFR.Code.ToString());
                Console.WriteLine("Results Length: " + getFR.Results.Length);
                foreach (ET_List ResultList in getFR.Results)
                {
                    Console.WriteLine("--ID: " + ResultList.ID + ", Name: " + ResultList.ListName + ", Description: " + ResultList.Description);
                }

                Console.WriteLine("\n Update list");
                ET_List patchList = new ET_List();
                patchList.ID          = MyNewListID;
                patchList.Description = "This is the new description";
                patchList.AuthStub    = myclient;
                FuelSDK.PatchReturn patchFR = patchList.Patch();
                Console.WriteLine("Patch Status: " + patchFR.Status.ToString());
                Console.WriteLine("Message: " + patchFR.Message.ToString());
                Console.WriteLine("Code: " + patchFR.Code.ToString());
                Console.WriteLine("Results Length: " + patchFR.Results.Length);

                Console.WriteLine("\n Retrieve List that should have description updated");
                list.Props        = new string[] { "ID", "ListName", "Description" };
                list.SearchFilter = new SimpleFilterPart()
                {
                    Property = "ID", SimpleOperator = SimpleOperators.equals, Value = new String[] { MyNewListID.ToString() }
                };
                getFR = list.Get();
                Console.WriteLine("Get Status: " + getFR.Status.ToString());
                Console.WriteLine("Message: " + getFR.Message.ToString());
                Console.WriteLine("Code: " + getFR.Code.ToString());
                Console.WriteLine("Results Length: " + getFR.Results.Length);
                foreach (ET_List ResultList in getFR.Results)
                {
                    Console.WriteLine("--ID: " + ResultList.ID + ", Name: " + ResultList.ListName + ", Description: " + ResultList.Description);
                }

                Console.WriteLine("\n Delete List");
                ET_List delList = new ET_List();
                delList.ID       = MyNewListID;
                delList.AuthStub = myclient;
                FuelSDK.DeleteReturn fr = delList.Delete();
                Console.WriteLine("Delete Status: " + fr.Status.ToString());
                Console.WriteLine("Message: " + fr.Message.ToString());
                Console.WriteLine("Code: " + fr.Code.ToString());
                Console.WriteLine("Results Length: " + fr.Results.Length);

                Console.WriteLine("\n Retrieve List to confirm deletion");
                list.Props        = new string[] { "ID", "ListName", "Description" };
                list.SearchFilter = new SimpleFilterPart()
                {
                    Property = "ID", SimpleOperator = SimpleOperators.equals, Value = new String[] { MyNewListID.ToString() }
                };
                getFR = list.Get();
                Console.WriteLine("Get Status: " + getFR.Status.ToString());
                Console.WriteLine("Message: " + getFR.Message.ToString());
                Console.WriteLine("Code: " + getFR.Code.ToString());
                Console.WriteLine("Results Length: " + getFR.Results.Length);
                foreach (ET_List ResultList in getFR.Results)
                {
                    Console.WriteLine("--ID: " + ResultList.ID + ", Name: " + ResultList.ListName + ", Description: " + ResultList.Description);
                }

                Console.WriteLine("\n Info List");
                ET_List listInfo = new ET_List();
                listInfo.AuthStub = myclient;
                InfoReturn info = listInfo.Info();
                Console.WriteLine("Info Status: " + info.Status.ToString());
                Console.WriteLine("Message: " + info.Message.ToString());
                Console.WriteLine("Code: " + info.Code.ToString());
                Console.WriteLine("Results Length: " + info.Results.Length);
                foreach (ET_PropertyDefinition def in info.Results)
                {
                    Console.WriteLine("--Name: " + def.Name + ", IsRetrievable: " + def.IsRetrievable.ToString());
                }
            }
        }
Esempio n. 12
0
        static void TestET_ContentArea()
        {
            ET_Client myclient = new ET_Client();
            string    NameOfTestContentArea = "CSharpSDKContentArea";

            Console.WriteLine("--- Testing ContentArea ---");
            Console.WriteLine("\n Retrieve All ContentArea with GetMoreResults");
            ET_ContentArea getAllContentArea = new ET_ContentArea();

            getAllContentArea.AuthStub = myclient;
            getAllContentArea.Props    = new string[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" };
            GetReturn grAllContent = getAllContentArea.Get();

            Console.WriteLine("Get Status: " + grAllContent.Status.ToString());
            Console.WriteLine("Message: " + grAllContent.Message.ToString());
            Console.WriteLine("Code: " + grAllContent.Code.ToString());
            Console.WriteLine("Results Length: " + grAllContent.Results.Length);

            while (grAllContent.MoreResults)
            {
                Console.WriteLine("\n Continue Retrieve All ContentArea with GetMoreResults");
                grAllContent = getAllContentArea.GetMoreResults();
                Console.WriteLine("Get Status: " + grAllContent.Status.ToString());
                Console.WriteLine("Message: " + grAllContent.Message.ToString());
                Console.WriteLine("Code: " + grAllContent.Code.ToString());
                Console.WriteLine("Results Length: " + grAllContent.Results.Length);
            }

            Console.WriteLine("\n Create ContentArea");
            ET_ContentArea postContentArea = new ET_ContentArea();

            postContentArea.AuthStub    = myclient;
            postContentArea.Name        = NameOfTestContentArea;
            postContentArea.CustomerKey = NameOfTestContentArea;
            postContentArea.Content     = "<b>Some HTML Content Goes here</b>";
            PostReturn postResponse = postContentArea.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)
            {
                Console.WriteLine("\n Retrieve newly create ContentArea");
                ET_ContentArea getContentArea = new ET_ContentArea();
                getContentArea.AuthStub     = myclient;
                getContentArea.Props        = new string[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" };
                getContentArea.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestContentArea }
                };
                GetReturn getResponse = getContentArea.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_ContentArea ResultContentArea in getResponse.Results)
                {
                    Console.WriteLine("--ID: " + ResultContentArea.ID + ", Name: " + ResultContentArea.Name + ", Content: " + ResultContentArea.Content);
                }

                Console.WriteLine("\n Update ContentArea");
                ET_ContentArea patchContentArea = new ET_ContentArea();
                patchContentArea.CustomerKey = NameOfTestContentArea;
                patchContentArea.Content     = "<b>Some HTML Content Goes here. NOW WITH NEW CONTENT</b>";
                patchContentArea.AuthStub    = myclient;
                FuelSDK.PatchReturn patchFR = patchContentArea.Patch();
                Console.WriteLine("Patch Status: " + patchFR.Status.ToString());
                Console.WriteLine("Message: " + patchFR.Message.ToString());
                Console.WriteLine("Code: " + patchFR.Code.ToString());
                Console.WriteLine("Results Length: " + patchFR.Results.Length);

                Console.WriteLine("\n Retrieve updated ContentArea");
                getContentArea.Props        = new string[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" };
                getContentArea.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestContentArea }
                };
                getResponse = getContentArea.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_ContentArea ResultContentArea in getResponse.Results)
                {
                    Console.WriteLine("--ID: " + ResultContentArea.ID + ", Name: " + ResultContentArea.Name + ", Content: " + ResultContentArea.Content);
                }

                Console.WriteLine("\n Delete ContentArea");
                ET_ContentArea delContentArea = new ET_ContentArea();
                delContentArea.CustomerKey = NameOfTestContentArea;
                delContentArea.AuthStub    = myclient;
                DeleteReturn deleteResponse = delContentArea.Delete();
                Console.WriteLine("Delete Status: " + deleteResponse.Status.ToString());
                Console.WriteLine("Message: " + deleteResponse.Message.ToString());
                Console.WriteLine("Code: " + deleteResponse.Code.ToString());
                Console.WriteLine("Results Length: " + deleteResponse.Results.Length);

                Console.WriteLine("\n Retrieve ContentArea to confirm deletion");
                getContentArea.Props        = new string[] { "RowObjectID", "ObjectID", "ID", "CustomerKey", "Client.ID", "ModifiedDate", "CreatedDate", "CategoryID", "Name", "Layout", "IsDynamicContent", "Content", "IsSurvey", "IsBlank", "Key" };
                getContentArea.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestContentArea }
                };
                getResponse = getContentArea.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);

                //Console.WriteLine("\n Info ContentArea");
                //ET_ContentArea ContentAreaInfo = new ET_ContentArea();
                //ContentAreaInfo.authStub = myclient;
                //InfoReturn info = ContentAreaInfo.Info();
                //Console.WriteLine("Info Status: " + info.Status.ToString());
                //Console.WriteLine("Message: " + info.Message.ToString());
                //Console.WriteLine("Code: " + info.Code.ToString());
                //Console.WriteLine("Results Length: " + info.Results.Length);
                //foreach (ET_PropertyDefinition def in info.Results)
                //{
                //    Console.WriteLine("--Name: " + def.Name + ", IsRetrievable: " + def.IsRetrievable.ToString());
                //}
            }
        }
Esempio n. 13
0
        public string CreateTriggeredSendDefinition(string name, string customerKey, string description, string subject, string htmlBody)
        {
            try
            {
                DeleteSendClassification(customerKey);

                string emailCustomerKey = CreateEmail(name, customerKey, description, subject, htmlBody);

                //var sp = RetrieveSendProfile();
                //var dp = RetrieveDeliveryProfile();

                ET_SendClassification sendClassification = new ET_SendClassification();

                sendClassification.Name                            = name;
                sendClassification.CustomerKey                     = customerKey;
                sendClassification.SendClassificationType          = SendClassificationTypeEnum.Marketing;
                sendClassification.SendClassificationTypeSpecified = true;

                sendClassification.SenderProfile = new ET_SenderProfile()
                {
                    CustomerKey = "Default"
                };
                sendClassification.DeliveryProfile = new ET_DeliveryProfile()
                {
                    CustomerKey = "Default"
                };

                sendClassification.AuthStub = _etClient;
                PostReturn status = sendClassification.Post();

                string sendDefinitionCustomerKey = Guid.NewGuid().ToString();

                FuelSDK.ET_TriggeredSend postEmailSendDef = new FuelSDK.ET_TriggeredSend();
                postEmailSendDef.AuthStub    = _etClient;
                postEmailSendDef.Name        = name;
                postEmailSendDef.CustomerKey = sendDefinitionCustomerKey;
                postEmailSendDef.Description = description;

                postEmailSendDef.SendClassification  = (SendClassification)sendClassification; // new ET_SendClassification() { CustomerKey = sendClassification.CustomerKey };
                postEmailSendDef.TriggeredSendStatus = TriggeredSendStatusEnum.Active;

                FuelSDK.ET_Email email = new FuelSDK.ET_Email();
                email.Name        = name;
                email.AuthStub    = _etClient;
                email.CustomerKey = emailCustomerKey;

                postEmailSendDef.Email = email;

                PostReturn postResponse = postEmailSendDef.Post();

                if (postResponse.Status)
                {
                    return(sendDefinitionCustomerKey);
                }
                else
                {
                    return(string.Empty);
                }

                //return
                //    new PostReturnStatus()
                //    {
                //        Status = postResponse.Status.ToString(),
                //        Message = postResponse.Message.ToString(),
                //        Code = postResponse.Code.ToString(),
                //        ResultsLength = postResponse.Results.Length
                //};
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        static void TestET_TriggeredSend()
        {
            ET_Client myclient = new ET_Client();

            Console.WriteLine("--- Testing TriggeredSend ---");
            string TSNameForCreateThenDelete = Guid.NewGuid().ToString();
            string ExistingTSDCustomerKey    = "TEXTEXT";

            Console.WriteLine("\n Send Using an Existing Definition ");
            ET_TriggeredSend tsdSend = new ET_TriggeredSend();

            tsdSend.AuthStub    = myclient;
            tsdSend.CustomerKey = ExistingTSDCustomerKey;
            tsdSend.Subscribers = new ET_Subscriber[] { new ET_Subscriber()
                                                        {
                                                            EmailAddress = "*****@*****.**", SubscriberKey = "*****@*****.**"
                                                        } };
            SendReturn srSend = tsdSend.Send();

            Console.WriteLine("Send Status: " + srSend.Status.ToString());
            Console.WriteLine("Message: " + srSend.Message.ToString());
            Console.WriteLine("Code: " + srSend.Code.ToString());
            Console.WriteLine("Results Length: " + srSend.Results.Length);

            Console.WriteLine("\n Retrieve All TriggeredSend Definitions");
            ET_TriggeredSend tsdGetAll = new ET_TriggeredSend();

            tsdGetAll.AuthStub     = myclient;
            tsdGetAll.Props        = new string[] { "CustomerKey", "Name", "TriggeredSendStatus" };
            tsdGetAll.SearchFilter = new SimpleFilterPart()
            {
                Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { TSNameForCreateThenDelete }
            };
            GetReturn grAllTSD = tsdGetAll.Get();

            Console.WriteLine("Get Status: " + grAllTSD.Status.ToString());
            Console.WriteLine("Message: " + grAllTSD.Message.ToString());
            Console.WriteLine("Code: " + grAllTSD.Code.ToString());
            Console.WriteLine("Results Length: " + grAllTSD.Results.Length);

            foreach (ET_TriggeredSend result in grAllTSD.Results)
            {
                Console.WriteLine("--CustomerKey: " + result.CustomerKey + ", Name: " + result.Name + ", Status: " + result.TriggeredSendStatus.ToString());
            }

            Console.WriteLine("\n Create a TriggeredSend Definition");
            ET_TriggeredSend tsd = new ET_TriggeredSend();

            tsd.AuthStub    = myclient;
            tsd.Name        = TSNameForCreateThenDelete;
            tsd.CustomerKey = TSNameForCreateThenDelete;
            tsd.Email       = new ET_Email()
            {
                ID = 3113962
            };
            tsd.SendClassification = new ET_SendClassification()
            {
                CustomerKey = "2240"
            };
            PostReturn prTSD = tsd.Post();

            Console.WriteLine("Post Status: " + prTSD.Status.ToString());
            Console.WriteLine("Message: " + prTSD.Message.ToString());
            Console.WriteLine("Code: " + prTSD.Code.ToString());
            Console.WriteLine("Results Length: " + prTSD.Results.Length);

            Console.WriteLine("\n Retrieve Single TriggeredSend");
            ET_TriggeredSend tsdGet = new ET_TriggeredSend();

            tsdGet.AuthStub     = myclient;
            tsdGet.Props        = new string[] { "CustomerKey", "Name", "TriggeredSendStatus" };
            tsdGet.SearchFilter = new SimpleFilterPart()
            {
                Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { TSNameForCreateThenDelete }
            };
            GetReturn tsdGetSingle = tsdGet.Get();

            Console.WriteLine("Get Status: " + tsdGetSingle.Status.ToString());
            Console.WriteLine("Message: " + tsdGetSingle.Message.ToString());
            Console.WriteLine("Code: " + tsdGetSingle.Code.ToString());
            Console.WriteLine("Results Length: " + tsdGetSingle.Results.Length);

            foreach (ET_TriggeredSend result in tsdGetSingle.Results)
            {
                Console.WriteLine("--CustomerKey: " + result.CustomerKey + ", Name: " + result.Name + ", Status: " + result.TriggeredSendStatus.ToString());
            }

            Console.WriteLine("\n Start a TriggeredSend by setting to Active");
            ET_TriggeredSend tsdPatch = new ET_TriggeredSend();

            tsdPatch.AuthStub            = myclient;
            tsdPatch.CustomerKey         = TSNameForCreateThenDelete;
            tsdPatch.TriggeredSendStatus = TriggeredSendStatusEnum.Active;
            PatchReturn patchrTSD = tsdPatch.Patch();

            Console.WriteLine("Patch Status: " + patchrTSD.Status.ToString());
            Console.WriteLine("Message: " + patchrTSD.Message.ToString());
            Console.WriteLine("Code: " + patchrTSD.Code.ToString());
            Console.WriteLine("Results Length: " + patchrTSD.Results.Length);

            Console.WriteLine("\n  Retrieve Single TriggeredSend After setting to active");
            tsdGetSingle = tsdGet.Get();
            Console.WriteLine("Get Status: " + tsdGetSingle.Status.ToString());
            Console.WriteLine("Message: " + tsdGetSingle.Message.ToString());
            Console.WriteLine("Code: " + tsdGetSingle.Code.ToString());
            Console.WriteLine("Results Length: " + tsdGetSingle.Results.Length);

            foreach (ET_TriggeredSend result in tsdGetSingle.Results)
            {
                Console.WriteLine("--CustomerKey: " + result.CustomerKey + ", Name: " + result.Name + ", Status: " + result.TriggeredSendStatus.ToString());
            }

            Console.WriteLine("\n  Send using new definition");
            ET_TriggeredSend tsdSendNew = new ET_TriggeredSend();

            tsdSendNew.AuthStub    = myclient;
            tsdSendNew.CustomerKey = TSNameForCreateThenDelete;
            tsdSendNew.Subscribers = new ET_Subscriber[] { new ET_Subscriber()
                                                           {
                                                               EmailAddress = "*****@*****.**", SubscriberKey = "*****@*****.**"
                                                           } };
            SendReturn srSendnew = tsdSendNew.Send();

            Console.WriteLine("Send Status: " + srSendnew.Status.ToString());
            Console.WriteLine("Message: " + srSendnew.Message.ToString());
            Console.WriteLine("Code: " + srSendnew.Code.ToString());
            Console.WriteLine("Results Length: " + srSendnew.Results.Length);

            Console.WriteLine("\n Pause a TriggeredSend by setting to Inactive");
            tsdPatch.TriggeredSendStatus = TriggeredSendStatusEnum.Inactive;
            patchrTSD = tsdPatch.Patch();
            Console.WriteLine("Patch Status: " + patchrTSD.Status.ToString());
            Console.WriteLine("Message: " + patchrTSD.Message.ToString());
            Console.WriteLine("Code: " + patchrTSD.Code.ToString());
            Console.WriteLine("Results Length: " + patchrTSD.Results.Length);

            Console.WriteLine("\n Delete a TriggeredSend Definition");
            ET_TriggeredSend tsdDelete = new ET_TriggeredSend();

            tsdDelete.AuthStub    = myclient;
            tsdDelete.CustomerKey = TSNameForCreateThenDelete;
            DeleteReturn drTSD = tsdDelete.Delete();

            Console.WriteLine("Delete Status: " + drTSD.Status.ToString());
            Console.WriteLine("Message: " + drTSD.Message.ToString());
            Console.WriteLine("Code: " + drTSD.Code.ToString());
            Console.WriteLine("Results Length: " + drTSD.Results.Length);
        }
Esempio n. 15
0
        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());
            //}
        }
Esempio n. 16
0
        static void TestET_Email()
        {
            ET_Client myclient        = new ET_Client();
            string    NameOfTestEmail = "CSharpSDKEmail";

            Console.WriteLine("--- Testing Email ---");
            Console.WriteLine("\n Retrieve All Email with GetMoreResults");
            ET_Email getAllEmail = new ET_Email();

            getAllEmail.AuthStub = myclient;
            getAllEmail.Props    = new string[] { "ID", "PartnerKey", "CreatedDate", "ModifiedDate", "Client.ID", "Name", "Folder", "CategoryID", "TextBody", "Subject", "IsActive", "IsHTMLPaste", "ClonedFromID", "Status", "EmailType", "CharacterSet", "HasDynamicSubjectLine", "ContentCheckStatus", "Client.PartnerClientKey", "ContentAreas", "CustomerKey" };
            GetReturn grAllEmail = getAllEmail.Get();

            Console.WriteLine("Get Status: " + grAllEmail.Status.ToString());
            Console.WriteLine("Message: " + grAllEmail.Message.ToString());
            Console.WriteLine("Code: " + grAllEmail.Code.ToString());
            Console.WriteLine("Results Length: " + grAllEmail.Results.Length);

            while (grAllEmail.MoreResults)
            {
                Console.WriteLine("\n Continue Retrieve All Email with GetMoreResults");
                grAllEmail = getAllEmail.GetMoreResults();
                Console.WriteLine("Get Status: " + grAllEmail.Status.ToString());
                Console.WriteLine("Message: " + grAllEmail.Message.ToString());
                Console.WriteLine("Code: " + grAllEmail.Code.ToString());
                Console.WriteLine("Results Length: " + grAllEmail.Results.Length);
            }

            Console.WriteLine("\n Create Email");
            ET_Email postEmail = new ET_Email();

            postEmail.AuthStub    = myclient;
            postEmail.Name        = NameOfTestEmail;
            postEmail.CustomerKey = NameOfTestEmail;
            postEmail.Subject     = "Created Using the Fuel SDK";
            postEmail.HTMLBody    = "<b>Some HTML Goes here</b>";
            PostReturn postResponse = postEmail.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)
            {
                Console.WriteLine("\n Retrieve newly create Email");
                ET_Email getEmail = new ET_Email();
                getEmail.AuthStub     = myclient;
                getEmail.Props        = new string[] { "ID", "PartnerKey", "CreatedDate", "ModifiedDate", "Client.ID", "Name", "Folder", "CategoryID", "HTMLBody", "TextBody", "Subject", "IsActive", "IsHTMLPaste", "ClonedFromID", "Status", "EmailType", "CharacterSet", "HasDynamicSubjectLine", "ContentCheckStatus", "Client.PartnerClientKey", "ContentAreas", "CustomerKey" };
                getEmail.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestEmail }
                };
                GetReturn getResponse = getEmail.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_Email ResultEmail in getResponse.Results)
                {
                    Console.WriteLine("--ID: " + ResultEmail.ID + ", Name: " + ResultEmail.Name + ", HTMLBody: " + ResultEmail.HTMLBody);
                }

                Console.WriteLine("\n Update Email");
                ET_Email patchEmail = new ET_Email();
                patchEmail.CustomerKey = NameOfTestEmail;
                patchEmail.HTMLBody    = "<b>Some HTML Goes here. NOW WITH NEW CONTENT</b>";
                patchEmail.AuthStub    = myclient;
                FuelSDK.PatchReturn patchFR = patchEmail.Patch();
                Console.WriteLine("Patch Status: " + patchFR.Status.ToString());
                Console.WriteLine("Message: " + patchFR.Message.ToString());
                Console.WriteLine("Code: " + patchFR.Code.ToString());
                Console.WriteLine("Results Length: " + patchFR.Results.Length);

                Console.WriteLine("\n Retrieve updated Email");
                getEmail.Props        = new string[] { "ID", "PartnerKey", "CreatedDate", "ModifiedDate", "Client.ID", "Name", "Folder", "CategoryID", "HTMLBody", "TextBody", "Subject", "IsActive", "IsHTMLPaste", "ClonedFromID", "Status", "EmailType", "CharacterSet", "HasDynamicSubjectLine", "ContentCheckStatus", "Client.PartnerClientKey", "ContentAreas", "CustomerKey" };
                getEmail.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestEmail }
                };
                getResponse = getEmail.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_Email ResultEmail in getResponse.Results)
                {
                    Console.WriteLine("--ID: " + ResultEmail.ID + ", Name: " + ResultEmail.Name + ", HTMLBody: " + ResultEmail.HTMLBody);
                }

                Console.WriteLine("\n Delete Email");
                ET_Email delEmail = new ET_Email();
                delEmail.CustomerKey = NameOfTestEmail;
                delEmail.AuthStub    = myclient;
                DeleteReturn deleteResponse = delEmail.Delete();
                Console.WriteLine("Delete Status: " + deleteResponse.Status.ToString());
                Console.WriteLine("Message: " + deleteResponse.Message.ToString());
                Console.WriteLine("Code: " + deleteResponse.Code.ToString());
                Console.WriteLine("Results Length: " + deleteResponse.Results.Length);

                Console.WriteLine("\n Retrieve Email to confirm deletion");
                getEmail.Props        = new string[] { "ID", "PartnerKey", "CreatedDate", "ModifiedDate", "Client.ID", "Name", "Folder", "CategoryID", "HTMLBody", "TextBody", "Subject", "IsActive", "IsHTMLPaste", "ClonedFromID", "Status", "EmailType", "CharacterSet", "HasDynamicSubjectLine", "ContentCheckStatus", "Client.PartnerClientKey", "ContentAreas", "CustomerKey" };
                getEmail.SearchFilter = new SimpleFilterPart()
                {
                    Property = "CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new String[] { NameOfTestEmail }
                };
                getResponse = getEmail.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);

                Console.WriteLine("\n Info Email");
                ET_Email EmailInfo = new ET_Email();
                EmailInfo.AuthStub = myclient;
                InfoReturn info = EmailInfo.Info();
                Console.WriteLine("Info Status: " + info.Status.ToString());
                Console.WriteLine("Message: " + info.Message.ToString());
                Console.WriteLine("Code: " + info.Code.ToString());
                Console.WriteLine("Results Length: " + info.Results.Length);
                foreach (ET_PropertyDefinition def in info.Results)
                {
                    Console.WriteLine("--Name: " + def.Name + ", IsRetrievable: " + def.IsRetrievable.ToString());
                }
            }
        }