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?

  • 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. – David Devoy Feb 28 '17 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 – Jonathan Robbins Mar 1 '17 at 0:10
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.

| 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.