campaignmonitor/createsend-dotnet

createsend_dotnet.CreateSendOptions.ApiKey, multiple accounts

coalfaceed opened this issue · 3 comments

I am currently trying to use two Client accounts under one application using the createsendoptions apikey property. This doesn't appear to work when switching API keys in the same request? Or even without recompiling?

I get my IEnumerable with one API and Client Key, then set the createsend_dotnet.CreateSendOptions.ApiKey to my second API key and get another IEnumerable with another Client Key.

Every time I get the 102: Invalid ClientID error on the second call for campagin details. However if I switch the order of the api keys round, the error still occurs on the second call, so the ClientID isn't incorrect as such but the library is storing my first key indefinately on compilation?

For anyone to be able to help you with the problem you are experiencing, it would be most helpful if you posted the code which is causing you the problem you are experiencing.

This is a completely stripped down version of what i'm trying to do, just getting two sets of campaign details from 2 different API/Client keys, it falls over on the second GetCampaigns() call:

protected void Page_Load(object sender, EventArgs e)
{
    createsend_dotnet.CreateSendOptions.ApiKey = "www";
    var campaigns = GetCampaigns("xxx");

    createsend_dotnet.CreateSendOptions.ApiKey = "yyy";
    campaigns = GetCampaigns("zzz");


}

protected IEnumerable<CampaignDetail> GetCampaigns(string clientID)
{
    Client client = new Client(clientID);
    return client.Campaigns();
}

Thanks

Resolved. Merge with #15 if possible.