当我添加帐户的联系信息时,我看不到谷歌联系人中显示的工作地址。 我缺少什么设置?
我使用目录API:https://developers.google.com/admin-sdk/directory/v1/reference/users/insert 我正在使用NuGet包1.9.0.490
www.nuget.org/packages/Google.Apis /
我创建了一个用户,并设置了他的联系信息。 但是,当我在谷歌联系人中查找帐户时,我看不到地址信息。
List<UserAddress> newAddresses = new List<UserAddress>();
UserAddress newAddress = new UserAddress
{
Country = "Netherlands",
CountryCode = "NL",
Type = "work",
ExtendedAddress = "address extension", // just for demo
Locality = "amsterdam",
PoBox = "Postbus 1000", // just for demo
PostalCode = "1000 AA",
Primary = true,
Region = "Noord-Holland", // just for demo
StreetAddress = "Main street 1"
};
newAddresses.Add(newAddress);
User newUser = new User
{
Name = "Demo User",
PrimaryEmail = "demo.user@domain.com",
Addresses = newAddresses,
ChangePasswordAtNextLogin = true,
Password = "*****",
IncludeInGlobalAddressList = true,
IpWhitelisted = true,
OrgUnitPath = @"/User/Demo/",
AgreedToTerms = true,
IsMailboxSetup = true
};
X509Certificate2 certificate = new X509Certificate2(@"\location\P12File.p12", "notasecret", X509KeyStorageFlags.Exportable);
IEnumerable<string> scopes = new[] { DirectoryService.Scope.AdminDirectoryUser, DirectoryService.Scope.AdminDirectoryUserSecurity };
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer("ServiceAccountEmail@domain.com")
{
Scopes = scopes,
User = "AdminAccount@domain.com"
}.FromCertificate(certificate));
// Create the service.
var service = new DirectoryService(
new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Admin directory Provisioning Sample",
});
service.Users.Insert(newUser).Execute();
当我通过代码检索用户时,我可以看到信息已存储:
> + Addresses {[ {
> "type": "work",
> "poBox": "Postbus 1000",
> "extendedAddress": "address extension",
> "streetAddress": "Main street 1",
> "locality": "amsterdam",
> "region": "Noord-Holland",
> "postalCode": "1000 AA",
> "country": "Netherlands",
> "primary": true,
> "countryCode": "NL" } ]} object {Newtonsoft.Json.Linq.JArray}
我有一个联系人数据的图片示例:
https://drive.google.com/file/d/0B6t050r4NXnDM2pUTjJoY0ZHMVU/view?usp=sharing
答案 0 :(得分:0)
我也无法显示地址。在使用支持后,解决方案还是更新&#34;格式化的&#34;属性以及您希望为其地址显示的内容。这似乎没有记录。
示例:
{
"type":"work",
"formatted":"123 Nowhere Somewhereville MN 55555",
"streetAddress":"123 Nowhere",
"locality":"Somewhereville",
"region":"MN",
"postalCode":"55555"
}