Im Versuch, Google Person API für die Entwicklung von Anwendung zu lernen.C# google Leute api, peopleRequest vermisste PersonFields Attribut
Im Google API-Tutorial mit https://developers.google.com/people/v1/getting-started
using Google;
using Google.Apis.Auth.OAuth2;
using Google.Apis.People.v1;
using Google.Apis.People.v1.Data;
using Google.Apis.Services;
...
static void Main(string[] args)
{
// Create OAuth credential.
UserCredential credential =
GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "CLIENT_ID",
ClientSecret = "CLIENT_SECRET"
},
new[] { "profile",
"https://www.googleapis.com/auth/contacts.readonly" },
"me",
CancellationToken.None).Result;
// Create the service.
var peopleService = new PeopleService (new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "APP_NAME",
});
PeopleResource.ConnectionsResource.ListRequest peopleRequest =
peopleService.People.Connections.List("people/me");
peopleRequest.PersonFields = "names,emailAddresses";
ListConnectionsResponse connectionsResponse = peopleRequest.Execute();
IList<Person> connections = connectionsResponse.Connections;
Wenn ich das Beispielskript in dem Tutorial verwenden, wird die Information ok retrived.
Ich habe eine Visual Studio mit C# erstellt. I Addon Referance zu allen Google API benötigt.
Das Projekt kompilieren nicht, weil PersonFields nicht erkannt wird. Dieses Attribut wird für den Erfolg benötigt