When using Google.Apis.PeopleService.v1, the people.connections.list method seems to work (no exceptions are thrown) but the returned object always have all its fields set to null. Here is the relevant code:
var scopes = new[] { PeopleServiceService.Scope.ContactsReadonly, PeopleServiceService.ScopeConstants.Contacts };
var credential = GoogleCredential.FromFile("./my-secrets.json")
.CreateScoped(scopes);
var service = new PeopleServiceService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
});
var req = service.People.Connections.List("people/me");
req.PageSize = 2000;
req.RequestMaskIncludeField = "person.names";
req.Fields = "connections,totalItems,nextSyncToken";
var res = await req.ExecuteAsync();
Console.WriteLine(res.Connections.Count); // <-- NullReferenceException
my-secrets.json is the secrets file downloaded from console.developers.google.com. It looks like this:
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
Does someone know what I'm missing ?