by
0
5
113k
11
Top 1% !
Pearl of Wisdom
Easy-to-find
Refined
OpenSource
Popularity: 19271st place

Published on:

.NETFramework4.0
Architecturex86_64
Extension.cs
LanguageCSharp
LicenseMIT_X11
OSWindows

How to Retrieve your personal information 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!
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/228775/How-to-Retrieve-your-personal-informatio?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static void GetPersonalDataFields(string clientID, string clientSecret, string username, string password) { // 1) Setup the MailUp Client: MailUpClient client = new MailUpClient(clientID, clientSecret); try { client.RetrieveAccessToken(username, password); } catch (MailUpException ex) { Console.WriteLine("Unable to access the service due to " + ex.Message); return; } // 2) Prepare the input: //nothing to do here... // 3) Invoke the web method: CollectionOf<ConsoleDynamicFieldItem> result = null; try { result = client.GetPersonalDataFields(); } catch (Exception ex) { Console.WriteLine("Cannot perform the operation due to " + ex.Message); return; } if (result != null) Console.WriteLine("Personal Data Fields Retrieved: " + result.Count); else Console.WriteLine("Cannot retrieve Personal Data Fields."); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus