How to Retrieve a group of recipients given its ID with MailUp .NET SDK
This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication.
You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API
An instance of MailUpClient class is able to manage one user at a time.
A MailUpClient object needs a pair clientID-clientSecret, which you can retrieve following this procedure: http://help.mailup.com/display/mailupapi/Authenticating+with+OAuth+v2
Then, you should login with your credentials, invoking RetrieveAccessToken(username, password) method (it should be done just only once at the beginning of the process)
Finally, you can call all the methods you want!
E.g. to retrieve a group you should provide its ID and the ID of the list which the group belongs to.
post this code
public static void GetGroupByID(string clientID, string clientSecret, string username, string password)
// 1) Setup the MailUp Client:
MailUpClient client = new MailUpClient(clientID, clientSecret);
catch (MailUpException ex)
Console.WriteLine("Unable to access the service due to " + ex.Message);
// 2) Prepare the input:
int idList = 1;
int idGroup = 1;
// 3) Invoke the web method:
ConsoleGroupItem result = null;
result = client.GetGroup(idList, idGroup);
catch (Exception ex)
Console.WriteLine("Cannot perform the operation due to " + ex.Message);
// 4) Print results:
if (result != null)
Console.WriteLine("Group retrieved with name:" + result.Name);
Console.WriteLine("An error occurred while retrieving the group.");
If you want to be updated about similar snippets,
and follow our Channels