-
Notifications
You must be signed in to change notification settings - Fork 42
Description
If I use the Get method to get SubscriberDetail it fails if the email doesn't exist in the list.
If the user/email doesn't exist in the list I would expect it to return null.
If the user/email exists in the list (e.g. active or deleted) it returns an object with the correct state, but if the use doesn't already exist in the list, it doesn't continue in the code. E.g. in the following code sample the code doesn't reach the code with customFields or subscribe, which is not executed - only when the user/email already exists in the list.
I know the line with SubscriberDetail in the case is not necessary to subscribe the user to the list and if I remove this line it also works to subscribe users, who are not already in the list. However this line shouldn't prevent the rest of the code to be executed.
Subscriber subscriber = new Subscriber(_auth, _listId);
SubscriberDetail sd = subscriber.Get(model.Email);
List<SubscriberCustomField> customFields = new List<SubscriberCustomField>();
customFields.Add(new SubscriberCustomField() { Key = "AccountCreated", Value = "Ja" });
subscriber.Add(model.Email, null, customFields, true);
I guess it somewhere in this method fails to get the email/user or because the request fails.
createsend-dotnet/createsend-dotnet/Subscriber.cs
Lines 16 to 23 in c9ea4ea
| public SubscriberDetail Get(string emailAddress) | |
| { | |
| NameValueCollection queryArguments = new NameValueCollection(); | |
| queryArguments.Add("email", emailAddress); | |
| return HttpGet<SubscriberDetail>( | |
| string.Format("/subscribers/{0}.json", ListID), queryArguments); | |
| } |