0

Okay - why do I want to do this...

My SubscriberKey is my systems ContactID. My contacts can have multiple emails. The SentEvent identifies the Send and the Subscriber Key which I can retrieve successfully. However, I need to know which Data Extension was used which would give me the email address used.

So - I can retrieve Sends, which has Email and EmailSendDefinition unfortunately I cannot Retrieve the objects Email or EmailSendDefinition since they're not supported by the method. By adding "EmailSendDefinition.CustomerKey" my Request retrieves the Send data but I cannot then access the CustomerKey because it's not instantiated - ie

Can anyone point me in the right direction? or explain what the code (.Net C#) is doing wrong? or advise of a better method to meet the requirement?

Code is

    RetrieveRequest rr = new RetrieveRequest();
    rr.ObjectType = "Send";

    String[] props = { "ID", "EmailName", "Status", "EmailSendDefinition.CustomerKey", "Client.ID"};

    rr.Properties = props;

  APIObject[] results = null;
    String requestID = null;
    string status = null;
    APIObject[] lSources = null; 

    Send se = null;

    do
        {
            status = etFramework.Retrieve(rr, out requestID, out results);
          for (int i = 0; i < results.Length; i++)
            {
                //se = (Send)results[i];
                se = results[i] as Send;

                SendOutputBuffer.AddRow();
                SendOutputBuffer.EmailName = se.EmailName;
                SendOutputBuffer.SendID=se.ID;
                SendOutputBuffer.Status=se.Status;
                if (se.EmailSendDefinition != null)
                    MessageBox.Show(se.EmailSendDefinition.CustomerKey);
            }

            //This call the API again to get the next 2500 records
            rr = new RetrieveRequest();
            rr.ContinueRequest = requestID;
        } while (status.Equals("MoreDataAvailable"));//This means there are more than 2500 records 

2 Answers 2

0

Good question. It's one I've encountered myself.

It's been discussed previously:

It's not possible via API, but you can cook something up using Send Logging, which is basically involves inserting code into every email to record the sending Data Extension.

Problem is...you can send to multiple Data Extensions at once. Since only one is recorded, how do you differentiate? In some cases that doesn't matter, but...

2
  • Many thanks Adam, you've given me some hope!. Don't know how I missed the posts in the search. Commented Aug 24, 2015 at 13:36
  • I think this section of SE has a pretty nice set of tags, which is a great way to search, e.g. [marketing-cloud], [ampscript], etc. Commented Aug 24, 2015 at 14:17
0

You can use the personalisation string _DateSourceName and print these into a send log

You must log in to answer this question.

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