private void ListCreateRequest_Click(object sender, EventArgs e) { //ListCreateRequest // setup EMsgAPI object - EM EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateService EM = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateService(); // setup Authentication objects EMsgAPI_ListCreate_201101.RequestAuthentication reqAuth = new EMsgAPI_ListCreate_201101.RequestAuthentication(); EMsgAPI_ListCreate_201101.XDDSAuthType XDDSAuth = new EMsgAPI_ListCreate_201101.XDDSAuthType(); EMsgAPI_ListCreate_201101.UIDType uid = new EMsgAPI_ListCreate_201101.UIDType(); // init Authentication objects XDDSAuth.Password = txtAccessCode.Text; uid.Value = txtUserId.Text; XDDSAuth.RequesterID = uid; reqAuth.Item = XDDSAuth; // Setup Request and JobSummaryRequest / JobSummaryResult object EMsgAPI_Demo.EMsgAPI_ListCreate_201101.Request Request = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.Request(); EMsgAPI_Demo.EMsgAPI_ListCreate_201101.Response Response = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.Response(); EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateRequest ListCreate_Request = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateRequest(); EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateResult ListCreate_Result = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListCreateResult(); // Configure ListCreateReqeust object ListCreate_Request.CreateOption = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.CreateOptionType.CreateOrReplace; ListCreate_Request.CreateOptionSpecified = true; // Create ListIdType Object EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListIdType ListID = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListIdType(); // Set the List ownership based on cmbListOwnership value switch(cmbListOwnership.Text) { case "customer": // customer level list ListID.ownership = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.OwnershipLevelType.customer; break; case "user": // user level list ListID.ownership = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.OwnershipLevelType.user; break; default: // default to system level list ListID.ownership = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.OwnershipLevelType.system; break; } // switch // set ownershipSpecified value ListID.ownershipSpecified = true; // Set the List store value (MessageREACH or XDDS) switch (cmbDomain.Text) { case "usme": case "flusme": // Email Lists ListID.liststore = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListStoreType.MR; break; case "xip": case "test2": // Fax or Voice Lists ListID.liststore = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ListStoreType.XDDS; break; } // switch // Set List Name ListID.Value = txtListName.Text; // Set ListCreate_Reqeuest ListId object to ListId just created ListCreate_Request.ListId = ListID; // Free ListId object ListID = null; // Setup Documents EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocumentType[] Documents = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocumentType[1]; Documents[0] = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocumentType(); // Read in CSV file to attach for upload // Setup reusable variables for the document EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocDataType DocData = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocDataType(); string File; File = ReadAndEncodedFile(txtCSVList.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.DocEncodingFormat.base64; DocData.Value = File; Documents[0].Item = DocData; Documents[0].Filename = "CSVList.csv"; Documents[0].ItemElementName = EMsgAPI_Demo.EMsgAPI_ListCreate_201101.ItemChoiceType.DocData; Documents[0].@ref = "CSVList"; Documents[0].DocType = "text"; DocData = null; // Setup Table for List EMsgAPI_Demo.EMsgAPI_ListCreate_201101.TableType[] CSVList_Table = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.TableType[1]; CSVList_Table[0] = new EMsgAPI_Demo.EMsgAPI_ListCreate_201101.TableType(); CSVList_Table[0].Item = Documents[0]; CSVList_Table[0].@ref = "CSVList"; // Assign List to the ListCreate Object ListCreate_Request.ListContents = CSVList_Table; // Free CSVList_Table CSVList_Table = null; // Set Server URL and Proxy information if needed Set_Server_and_Proxy(EM); // Setup Reqeust Object Request.ReceiverKey = EM.Url; Request.Authentication = reqAuth; // Assign Request and Response objects to EM Object EM.RequestValue = Request; EM.ResponseValue = Response; // Try the ListCreate function call try { ListCreate_Result = EM.ListCreate(ListCreate_Request); } catch (Exception ex) { System.Console.WriteLine(ex.Message); System.Console.Read(); return; } string emfilename = "emresponse.xml"; string resfilename = "result.xml"; //string reqfilename = "request.xml"; try { //This will output the response, result and request(if uncommented) to XML files in the //installed directory. This can be very usefull for debugging or ir help is requested from //the EMAPI support team if (chkResult) { serializeResult(emfilename, EM.ResponseValue); serializeResult(resfilename, ListCreate_Result); //serializeResult(reqfilename, ListCreate_Request); } } catch (IOException io_error) { MessageBox.Show("Error - " + io_error, "Error", MessageBoxButtons.OK); } }