Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 KB | None | 0 0
  1.         private void CreateSendDef()
  2.         {
  3.             SoapClient framework2 = new SoapClient();
  4.             framework2.ClientCredentials.UserName.UserName = "XXX";
  5.             framework2.ClientCredentials.UserName.Password = "XXX";
  6.             String requestID;
  7.             String status;
  8.  
  9.             EmailSendDefinition sd = new EmailSendDefinition();
  10.             sd.CustomerKey = "API Send Definition to DE";
  11.             sd.Name = "API Send Definition to DE";
  12.             SendClassification sc = new SendClassification();
  13.             sc.Name = "Default Commercial";
  14.             sc.CustomerKey = "2239";
  15.             sd.SendClassification = sc;
  16.             SendDefinitionList sdl = new SendDefinitionList();
  17.             sdl.CustomObjectID = "8699590d-8962-de11-8767-001e0bcf2c98"; //This is the ObjectID of the Data Extension, you will need to do a retrieve to find this
  18.             sdl.DataSourceTypeID = DataSourceTypeEnum.CustomObject;
  19.             sdl.DataSourceTypeIDSpecified = true;
  20.             sdl.SendDefinitionListType = SendDefinitionListTypeEnum.SourceList;
  21.             sdl.SendDefinitionListTypeSpecified = true;
  22.             sd.SendDefinitionList = new SendDefinitionList[] { sdl };
  23.  
  24.             Email em = new Email();
  25.             em.ID = 3096380;
  26.             em.IDSpecified = true;
  27.             sd.Email = em;
  28.  
  29.             CreateResult[] cresults = framework2.Create(new CreateOptions(), new APIObject[] { sd }, out requestID, out status);
  30.  
  31.             foreach (CreateResult result in cresults)
  32.             {
  33.                 MessageBox.Show(result.StatusMessage);
  34.             }
  35.  
  36.             MessageBox.Show(requestID + ": " + status);
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement