【发布时间】:2017-11-29 14:04:52
【问题描述】:
我想获取用户 Google+ 帐户所有圈子中的人员列表。 我正在使用 Google People API,但列表始终返回 0。 代码如下:
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();
【问题讨论】:
-
欢迎来到
StackOverflow[SO],请更具体一点when asking question:到目前为止,您对代码示例进行了哪些尝试? / 你能指望什么? / 你得到什么错误? -
我期待经过身份验证的用户的人员列表。该id在google plus账号中有各个圈子的人。我也没有收到任何错误。它所做的只是返回一个计数为 0 的列表
-
然后写在你的问题里,你越具体,用户越能帮助你!我帮不了你,但我可以给你一些提示来提高你的问题质量:)如果你还没有读过它(stackoverflow.com/help/how-to-ask),那么你就知道了。
-
感谢您的宝贵意见 :-)
标签: c# google-plus google-api-dotnet-client