How to use / access the Gmail API from C# Windows 8

Download the code here – https://github.com/ismaelc/GmailAPI-Windows8-OAuth

This Windows 8 (C#/XAML) code demonstrates:

Getting an access token for the Gmail API using OAuth 2.0
Calling Gmail API (Get messages IDs)

Using the code:

This C#/XAML sample code is a modified version of another LinkedIn OAuth sample code. It’s re-targeted for Windows 8.1 using Microsoft Visual Studio Express 2013 for Windows.

To use this code, you need to set up your Gmail API credentials from the Google Developer Console. Check out these instructions on how to set up your account, and get your Client ID and Client Secret keys – https://github.com/ismaelc/GmailAPI-Windows8-OAuth

Advertisements

[Video] How to use the Mashape Windows 8 Sample Code

This is a video tutorial on how to set-up and use the Mashape Windows 8 Sample code that I have put up in Github, as described in another earlier post – https://chrispogeek.wordpress.com/2012/11/07/need-apis-for-your-windows-8-apps/

Mashape is an API Cloud Marketplace for developers. You can sign up for an account at http://www.mashape.com/

Need APIs for your Windows 8 apps?

*UPDATE – You can check the video tutorial of this post here*

If you’re looking for API ingredients for your Windows 8 applications, go check out Mashape.  They are an API Marketplace for your apps.  Instead of Googling/Binging your way to find new APIs, Mashape consolidates them for you, ready to be consumed.  No lengthy documentation whatsoever.  (Well, we still have to pay attention to documentation sometimes).  At this point they have 1100+ APIs listed there.  That’s good news for you, especially if you’re in a rush to win a hackathon or something 🙂

For C#, they currently have documentation here – https://www.mashape.com/docs/consume/csharp.   However if you’re looking for an async/await sample apt for your Windows 8 app, you’re in luck.  I have posted a sample code in Github that uses HttpClient (REST) to access Mashape-hosted APIs.

Before you download and run it, you should know that –

  1. The sample uses Bitly and WordCloudMaker APIs from Mashape.
  2. For both services, you would need to get a Mashape Authentication Header.
  3. For Bitly, you need a developer login and legacy API key.
  4. For WordCloudMaker, no API key is needed.
  5. Once you have retrieved info for number 2 and 3, you can plug them in to fields at the very top of the MainPage.xaml.cs file

Once you’re done with the above, test by hitting F5.  Study the code and start copy-pasting! 🙂

If you have questions or want to share a cool Windows 8/Mashape app that you’ve built, email chris@mashape.com

Happy coding!