0

This is the code I have:

APIObject[] results;

RetrieveRequest rr = new RetrieveRequest {
    ObjectType = "DataExtensionObject[" + "NameOfDataExtension" + "]",
    Properties = new string[] {
        "prop1", "prop2", "prop3"
    },
    Options = new RetrieveOptions { 
        Client = new ClientID { ID = Settings.BusinessUnitId, IDSpecified = true}
    } 
};
SimpleFilterPart filter = new SimpleFilterPart();
filter.Property = "EmailAddress";
filter.SimpleOperator = SimpleOperators.equals;
filter.Value = new[] { "email@email.com" };

rr.Filter = filter;

string requestID;

Client.GetClient().Retrieve(rr, out requestID, out results);

"results" variable always comes back empty. I know the code works because when I remove the retrieve options and create a data extension of the same name on the primary business unit it works fine. I know the ID is correct because I'm able to post to data extensions as well as post and get from publication lists with the same ID

Thanks

0

You may need to remove the double-quotes from around the NameOfDataExtension -- assuming it's a variable:

APIObject[] results;

RetrieveRequest rr = new RetrieveRequest {
    ObjectType = "DataExtensionObject[" + NameOfDataExtension + "]",
    Properties = new string[] {
        "prop1", "prop2", "prop3"
    },
    Options = new RetrieveOptions { 
        Client = new ClientID { ID = Settings.BusinessUnitId, IDSpecified = true}
    } 
};
SimpleFilterPart filter = new SimpleFilterPart();
filter.Property = "EmailAddress";
filter.SimpleOperator = SimpleOperators.equals;
filter.Value = new[] { "email@email.com" };

rr.Filter = filter;

string requestID;

Client.GetClient().Retrieve(rr, out requestID, out results);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.