Mrinal Das
Mrinal Das

Reputation: 25

List of Google Plus People contacts returns 0

I want to fetch the list of people in all the circles of a user's Google plus account. I am using the Google People API but the list always returns 0. The code is as below:

string[] scopes = new string[] {PlusService.Scope.PlusLogin,
            PlusService.Scope.UserinfoEmail,
            PlusService.Scope.UserinfoProfile};
string credPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            credPath = Path.Combine(credPath, ".credentials/", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
 UserCredential credential =
                    GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
                    {
                        ClientId = "someid",
                        ClientSecret = "somekey"
                    },
                                                                scopes,
                                                                Environment.UserName,
                                                                CancellationToken.None,
                                                            new FileDataStore(credPath,true)
                                                                ).Result;


            PlusService service = new PlusService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Google Plus Sample",
            });

            PeopleResource.ListRequest listPeople = service.People.List("me", PeopleResource.ListRequest.CollectionEnum.Visible);
            listPeople.MaxResults = 10;
            PeopleFeed peopleFeed =  listPeople.Execute();

Upvotes: 1

Views: 64

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116908

If you check the documentation for people.list you can see that this method doesnt work anymore.

The Google+ People API list endpoint is deprecated. Consider using the Google People API instead.

You can try and switch to the google people api but this is not a list of the users on Google+ IIR its a list of peolpe the user has setup in Google contacts.

Upvotes: 1

Related Questions