Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. public string Deliver(String firstname, String surname, String email) //override?
  2.  
  3.         {
  4.  
  5.             //LoadCustomerDataFile();
  6.  
  7.  
  8.  
  9.             SoapClient client = new SoapClient();
  10.             Console.WriteLine("Set up client.");
  11.             client.ClientCredentials.UserName.UserName = UserName;
  12.  
  13.             client.ClientCredentials.UserName.Password = Password;
  14.  
  15.             UpdateOptions uo = new UpdateOptions();
  16.  
  17.  
  18.             uo.SaveOptions = new SaveOption[1];
  19.  
  20.             uo.SaveOptions[0] = new SaveOption();
  21.        
  22.             uo.SaveOptions[0].SaveAction = SaveAction.UpdateAdd;//This set this call to act as an UpSert, meaning if the Subscriber doesn't exist it will Create if it does it will Update
  23.  
  24.             uo.SaveOptions[0].PropertyName = "*";
  25.  
  26.    
  27.        
  28.             DataExtensionObject deo2 = GetDataExtensionObject(firstname, surname, email);
  29.             string result = "";
  30.             string uRequestID2 = String.Empty;
  31.             string uStatus2 = String.Empty;
  32.             UpdateResult[] uResults2 = client.Update(uo, new APIObject[] { deo2 }, out uRequestID2, out uStatus2);
  33.             Console.WriteLine("Updated!");
  34.  
  35.             result = result + "uRequestID is: " + uRequestID2 + "and uStatus is: " + uStatus2 + ". ";
  36.  
  37.  
  38.             //Loop through each object returned and display the StatusMessage
  39.  
  40.             foreach (UpdateResult cr in uResults2)
  41.  
  42.  
  43.             {
  44.                 result = result + " Result is: " + cr.StatusMessage;
  45.  
  46.             }
  47.  
  48.  
  49.             return result;
  50.  
  51.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement