微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在哪里可以找到 Google People API 的示例 C# .NET 代码?

如何解决在哪里可以找到 Google People API 的示例 C# .NET 代码?

我有一个使用 .NET 和 Contacts API 的已安装应用。我正在尝试转换为 People API。我在开始和查找展示如何使用 People API 和 .NET 库的示例时遇到问题。例如,Peoples API documentation 下列出的示例不包括 .NET。在哪里可以找到 People API 的 .NET 示例?

解决方法

从这个开始;)

https://googleapis.dev/dotnet/Google.Apis.PeopleService.v1/latest/api/Google.Apis.PeopleService.v1.html

获取名为 Google.Apis.PeopleService.v1 https://github.com/googleapis/google-api-dotnet-client

的 nuget

另外,我相信你已经看过这个https://developers.google.com/people/v1/profiles 它有一些 .net 示例。

你到底想完成什么? 我即将完成将使用联系人 API 的应用转换为使用公司服务帐户的人员 API。

ps。我无法通过链接复制答案中的整个命名空间。

编辑:20210608

        Person person = new Person();

        person.EmailAddresses = new List<EmailAddress>();
        person.EmailAddresses.Add(new EmailAddress() { Type = "work",Value = "sample@domain.com" });
        person.Names = new List<Name>();
        person.Names.Add(new Name() { FamilyName = "Lname2",GivenName = "Fname" });

        // link to peopleService code can be found in the comments
        // it's basically initializing PeopleServiceService with service account credentials
        Person retVal = peopleService.People.CreateContact(person).Execute();

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。