0

I was able to create a web based application for Gmail API to get all the unread emails from specific email address in Javas Script. But I need to use stand alone application. I chose VB using VS 2017. I was able to connect and Authenticated and get label but can't get to the part to search for unread (and from) using filter parameters.

scope.Add(GmailService.Scope.MailGoogleCom)
        Dim credential =GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, scope, "Client ", CancellationToken.None).Result()
        initializer.HttpClientInitializer = credential
        initializer.ApplicationName = "Gmail API Quickstart"
        Dim service = New GmailService(initializer)
        Dim userId As String = "email@gmail.com"


Dim request As UsersResource.LabelsResource.ListRequest = service.Users.Labels.List("me")
        ' List labels.
        Dim labels As IList(Of Label) = request.Execute().Labels
        Console.WriteLine("Labels:")
        If labels IsNot Nothing AndAlso labels.Count > 0 Then
            For Each labelItem In labels
                MsgBox(labelItem.Name)
            Next
        Else
            Console.WriteLine("No labels found.")
        End If

I appropriate any help. Thanks

James KM
  • 69
  • 8
  • Check this out - this might help, it is in C# but you could at least get the concept. http://www.developerfusion.com/article/4071/how-to-pop3-in-c/ – codeMonger123 Apr 17 '17 at 14:41

1 Answers1

0

You may refer with this related SO post: How to get unread mails from primary inbox in Gmail?. You can try this "in:inbox is:unread -category:(promotions OR social)" as a value for q parameter in messages.list. Also be noted that parameter cannot be used when accessing the api using the gmail.metadata scope.

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59