vb.net - Issue with "Get" message with gmail api v1 (Net) -


im trying info of gmail message in datagridview returns datagridview empty (even when erase "return nothing" line) when try in apis-explorer 200 ok response. doing wrong?

the code im using google developers documentation:

imports google.apis.auth.oauth2 imports google.apis.services imports google.apis.tasks.v1 imports google.apis.tasks.v1.data.tasks imports google.apis.tasks.v1.data imports system.collections.generic imports google.apis.util.store imports system.threading imports system imports google.apis.gmail.v1 imports google.apis.gmail.v1.data  public class form1     dim secrets = new clientsecrets()     dim scope = new list(of string)     dim initializer = new baseclientservice.initializer     private sub form1_load(sender object, e eventargs) handles mybase.load         secrets.clientid = "client_id"         secrets.clientsecret = "client_secret"     end sub    public shared function getmessage(service gmailservice, userid [string], messageid [string]) message         try             return service.users.messages.get(userid, messageid).execute()         catch ex exception             msgbox(ex.tostring)         end try         'return nothing     end function     private sub button14_click(sender object, e eventargs) handles button14.click         dim userid string = "gmail account"         dim messageid string = "message id"         try             scope.add(gmailservice.scope.mailgooglecom)             dim credential = googlewebauthorizationbroker.authorizeasync(secrets, scope, "xxxxxxxxxxxx@developer.gserviceaccount.google.com", cancellationtoken.none).result()             initializer.httpclientinitializer = credential             initializer.applicationname = "app name"             dim service = new gmailservice(initializer)             me.datagridview1.datasource = getmessage(service, userid, messageid)         catch ex exception             msgbox(ex.tostring)         end try     end sub end class 

thanks eric solved making changes. hope helps other people because google developers documentation not clear

imports google.apis.auth.oauth2 imports google.apis.services imports system.collections.generic imports google.apis.util.store imports system.threading imports system imports google.apis.gmail.v1 imports google.apis.gmail.v1.data  public class form1     dim secrets = new clientsecrets()     dim scope = new list(of string)     dim initializer = new baseclientservice.initializer     private sub form1_load(sender object, e eventargs) handles mybase.load         secrets.clientid = "client id"         secrets.clientsecret = "client secret"     end sub     public shared function getmessage(service gmailservice, userid [string], messageid [string]) message         try             return service.users.messages.get(userid, messageid).execute         catch ex exception             msgbox(ex.tostring)         end try          return nothing     end function      private sub button14_click(sender object, e eventargs) handles button14.click         try             scope.add(gmailservice.scope.mailgooglecom)             dim credential = googlewebauthorizationbroker.authorizeasync(secrets, scope, "xxxxxxxxxxxxx@developer.gserviceaccount.google.com", cancellationtoken.none).result()             initializer.httpclientinitializer = credential             initializer.applicationname = "app name"             dim service = new gmailservice(initializer)             dim userid string = "email"             dim messageid string = "message id"              me.datagridview1.datasource = getmessage(service, userid, messageid).payload.headers             textbox1.text = (getmessage(service, userid, messageid).snippet)                 catch ex exception             msgbox(ex.tostring)         end try     end sub end class  

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -