Using Google API for .Net

Let's using uploading a video to YouTube as an example:

  1. Install Google API NuGet packages.  This can be easily done in VS.
  2. Create a client ID at API Access pane
  3. Download client_secrets.json from API Access pane and save in the project. Make sure set the Build Action to Resource for this file.
  4. Refer to the example of Google Google API Client Library for .NET OAuth 2.0 page to get a  UserCredential. Use YouTubeService.Scope.YoutubeUpload in the scopes parameter.
  5. If this is a Windows Phone project, disable XAML validation to remedy a bug.
  6. Refer to the YouTube Data API video uploading example for the uploading code.  
  7. It is critical to enalble YouTube Data API in Google Developer Console.  Without enabling it, one will get 404 error when uploading a video.