Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting Google Contacts

Getting Google Contacts

Scheduled Pinned Locked Moved C#
wpftutorialcsharpcomalgorithms
13 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kevin Marois

    I am looking at this Google API WPF OAuth Example[^] I understand most of what it's doing. In userinfoCall() it displays the Google user's info

    Making API Call to Userinfo...
    {
    "sub": "",
    "name": "Kevin Marois",
    "given_name": "Kevin",
    "family_name": "Marois",
    "locale": "en"
    }

    What I need is to get the user's contacts. I've been searching & playing with this all day but I can't figure out how to do this.

    In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #4

    I was right:

    How Sign in with Google helps you share data safely - Google Account Help[^]

    What data Google shares Important: Sign in with Google doesn’t share your Google Account password. When you use Sign in with Google to access a third-party app or service, Google only shares the following information associated with your Google Account: Your name Your email address Your profile picture This data is only shared after you give permission. If you want to use Sign in with Google, you can't exclude any of these pieces of data. In addition to your name, email address, and profile picture, the third party might request further access to some of your Google Account data.

    You might be able to get contact access if you asked for it when you tried to use OAuth as a added permission, but even that's dodgy with GDPR as it includes other people's personal info so technically you might need permission from each individual in my contacts in order to get them. :-D

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    1 Reply Last reply
    0
    • K Kevin Marois

      I am looking at this Google API WPF OAuth Example[^] I understand most of what it's doing. In userinfoCall() it displays the Google user's info

      Making API Call to Userinfo...
      {
      "sub": "",
      "name": "Kevin Marois",
      "given_name": "Kevin",
      "family_name": "Marois",
      "locale": "en"
      }

      What I need is to get the user's contacts. I've been searching & playing with this all day but I can't figure out how to do this.

      In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #5

      Yeah ... "contacts" are "personal" information; just what your spammer / hacker is looking for.

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      1 Reply Last reply
      0
      • L Lost User

        Maybe this is what you need to look at: Read and Manage Contacts  |  People API  |  Google for Developers[^]

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #6

        Certainly looks like that should answer the OPs question. As a side note looking at that very quickly I didn't see any mention of what happens if the reader doesn't have permission to view those. Seems like that would be a very relevant error case. Certainly something that a developer should test.

        L 1 Reply Last reply
        0
        • J jschell

          Certainly looks like that should answer the OPs question. As a side note looking at that very quickly I didn't see any mention of what happens if the reader doesn't have permission to view those. Seems like that would be a very relevant error case. Certainly something that a developer should test.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #7

          jschell wrote:

          I didn't see any mention of what happens if the reader doesn't have permission to view those.

          I think that may be dealt with in the section about getting set up to use the People API.

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            I very much doubt if you can: I'd class my contacts list as "personal information" and I'd be pretty unhappy if any site I logged into using Google had access to them or my calendar. There is also GDPR which would almost certainly apply, and Google isn't going to ignore that!

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            K Offline
            K Offline
            Kevin Marois
            wrote on last edited by
            #8

            You, as the user, authorize it via an OAuth window. We already had this functionality in out app, then Google changed their Auth process. I'm just trying to upddate the app See this[^] I just can't figure out how to integrate that into their sample code

            In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

            1 Reply Last reply
            0
            • L Lost User

              Maybe this is what you need to look at: Read and Manage Contacts  |  People API  |  Google for Developers[^]

              K Offline
              K Offline
              Kevin Marois
              wrote on last edited by
              #9

              I saw that already. I can't figure out how to integrate that first bit into their sample

              In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

              L 1 Reply Last reply
              0
              • K Kevin Marois

                I saw that already. I can't figure out how to integrate that first bit into their sample

                In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                I'm afraid that using the Google API's is not the easiest thing in the world, IMHO. You need to follow the link to the setup section and start there. It's a good few years since I set up my account (which has since been deleted) so i'm afraid I can't offer any insights.

                K J 2 Replies Last reply
                0
                • L Lost User

                  I'm afraid that using the Google API's is not the easiest thing in the world, IMHO. You need to follow the link to the setup section and start there. It's a good few years since I set up my account (which has since been deleted) so i'm afraid I can't offer any insights.

                  K Offline
                  K Offline
                  Kevin Marois
                  wrote on last edited by
                  #11

                  OK, thanks anyway

                  In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

                  1 Reply Last reply
                  0
                  • L Lost User

                    I'm afraid that using the Google API's is not the easiest thing in the world, IMHO. You need to follow the link to the setup section and start there. It's a good few years since I set up my account (which has since been deleted) so i'm afraid I can't offer any insights.

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #12

                    Just curious - have you used any non trivial API ever that was easy? Perhaps not just initially but including support? Myself I was used 'bitly' which seemed pretty easy except that they throttled using a HTTP 500 error with no other error message. So no way to know if there was a problem on their end or if one had just reached the throttle limit. Noting of course that HTTP 429 exists for exactly this reason.

                    L 1 Reply Last reply
                    0
                    • J jschell

                      Just curious - have you used any non trivial API ever that was easy? Perhaps not just initially but including support? Myself I was used 'bitly' which seemed pretty easy except that they throttled using a HTTP 500 error with no other error message. So no way to know if there was a problem on their end or if one had just reached the throttle limit. Noting of course that HTTP 429 exists for exactly this reason.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #13

                      Once I figured out the rules it was easy. But, as with most things, the learning curve was a bit steep.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups