/// <summary> /// Patch this instance. /// </summary> /// <returns>The <see cref="T:FuelSDK.PatchReturn"/> object..</returns> public PatchReturn Patch() { ETDataExtension de = this; de.Fields = Columns; de.Columns = null; var pr = new PatchReturn(de); foreach (var rd in pr.Results) { ((ETDataExtension)rd.Object).Columns = (ETDataExtensionColumn[])((ETDataExtension)rd.Object).Fields; ((ETDataExtension)rd.Object).Fields = null; } return(pr); }
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_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()); //} } }
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()); } } }
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()); } } }