1

I'm passing the following RetrieveRequest to retrieve data from a DataExtension.

var retrieveRequest = new RetrieveRequest
        {
            ObjectType = "DataExtensionObject[DataExtensionName]",
            Properties = new string[]
            {
                "SubscriberKey",
                "FirstName",
                "LastName"
            },
            Filter = new SimpleFilterPart
            {
                Property = SubscriberKey,
                SimpleOperator = SimpleOperators.equals,
                Value = new string[] { EmailAddress }
            },
        };

This worked correctly for a number of months before lying dormat. It has since been reactivated however it is now returning Data extension does not exist error message.

I believe its because a new Business Unit has been added to the instance and using the incorrect one. I tried to tell it which Business Unit to use by using (what I think is) the Business Unit in the following way

retrieveRequest.Options = new RetrieveOptions()
                {
                    Client = new ClientID() { ID = 7296948, IDSpecified = true }
                }

However still no luck. Am I on the right path?

Only other thing I could think of is that the folder structure of the Data Extensions have changed so the Data Extension is now nested under a number of folders but that shouldn't affect it surely?

2
  • Do you use user name and password to authenticate? Do you specify an mid when authenticating? If not, then your API login is defaulting to what may be the wrong mid. Feb 28, 2017 at 19:21
  • That's correct I specify the Username and password to authenticate but I don't specify anything else such as a mid? This is the sample code I based the implementation on - developer.salesforce.com/docs/… for some context Mar 1, 2017 at 0:10

1 Answer 1

3

Since you have added new Business Units to the account and you are using an API username and password that likely have access to both business units (MIDs) you need to specify which business unit you want the call to execute against by setting the ClientIDs property of the RetrieveRequest. I would update your code to be:

    var retrieveRequest = new RetrieveRequest
    {
        ClientIDs = new ExactTargetClient.ClientID[] { new ExactTargetClient.ClientID() { ID = 7296948, IDSpecified = true } },
        ObjectType = "DataExtensionObject[DataExtensionName]",
        Properties = new string[]
    {
        "SubscriberKey",
        "FirstName",
        "LastName"
    },
        Filter = new SimpleFilterPart
        {
            Property = SubscriberKey,
            SimpleOperator = SimpleOperators.equals,
            Value = new string[] { EmailAddress }
        },
    };

A "better" option is to use OAuth API credentials which are easier to manage, control and rotate. Each credential is associated to a single business unit so you also don't have to deal with always having to specify the ClientID (MID) for each and every API call you want to make.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .