I'm creating a filter definition through the api, on an enterprise 2 account. When I add a datasource from a data extension object it works fine, but when I add a null datasource to indicate list attributes, I get the following:
Status Message: The DataFilter that was provided is invalid.
Error Code: 373009
This is my entire code for the method. I have also removed the datasource declaration. That doesn't help
string Status = String.Empty; string Message = String.Empty; string RequestID = String.Empty; try { // Create Filter FilterDefinition fd = new FilterDefinition(); fd.DataSource = new SubscriberList(); fd.DataSource.CustomerKey = "All Subscribers"; fd.Name = "Test Filter1"; fd.CustomerKey = "Test_Filter1"; fd.Description = "description"; SimpleFilterPart sp1 = new SimpleFilterPart(); sp1.Property = "Status"; sp1.SimpleOperator = SimpleOperators.equals; sp1.Value = new String[] { "Active" }; fd.DataFilter = sp1; // Execute CreateRequest CreateResult[] results = null; results = client.Create(null, new APIObject[] { fd }, out RequestID, out Status); foreach (CreateResult cr in results) { lblMessage.Text += "Status Message: " + cr.StatusMessage; lblMessage.Text += "
"; lblMessage.Text += "Error Code: " + cr.ErrorCode; lblMessage.Text += "
"; } } catch (Exception exc) { //Set Message lblMessage.Text += "ERROR: " + exc.Message; }
Any help would be good. I even though of doing a retrieve of an already created filter, but when retrieving the datasource, I get an error that it's out of bound of the array.
Thanks