我正在生成一个用户,并将他们填充到我们的Google Workspace环境中,但我似乎无法使CustomSchemas工作. 我已经摆弄了几种不同的格式化方法,但我仍然无法让它正常工作.
userGoogleUserWithData = new User()
{
PrimaryEmail = userEmail,
Password = generatedPassword,
Name = new UserName
{
GivenName = givenName,
FamilyName = familyName
},
ChangePasswordAtNextLogin = true,
OrgUnitPath = "/",
Suspended = false,
Relations = new List<UserRelation>
{
new UserRelation { Type = "manager", Value = googleData.manager } // Set the manager's email
},
Addresses = new List<UserAddress>
{
new UserAddress
{
Type = "work",
Formatted = googleData.locationAddress,
Locality = myBranch.branchCity,
Region = myBranch.branchState,
PostalCode = myBranch.branchZip,
Country = myBranch.branchCountry
}
},
Organizations = new List<UserOrganization>
{
new UserOrganization
{
Title = googleData.jobTitle,
Primary = true,
Department = googleData.department,
CostCenter = googleData.costCenter,
Description = "user",
Name = "Test Company"
}
},
CustomSchemas = new Dictionary<string, object>
{
["Custom Field Testing"] = new Dictionary<string, string>
{
["blah text"] = "Test Value"
}
}
};
service.Users.Insert(userGoogleUserWithData).Execute();
自定义现场测试和BLAH文本应该是我工作空间中的关键值.我的格式有误吗? 无论我如何设置它,它都会继续给我一个错误CS0266.
完全错误:
严重性代码说明项目文件行 suppress 状态详细信息 错误CS0266无法将类型‘System.Collections.Generic.Dictionary<;string,对象>;’隐式转换为‘System.Collections.Generic.IDictionary<;string,System.Collections.Generic.IDictionary<;string,对象>;’.存在显式转换(是否缺少强制转换?)277活动
第277行是:
CustomSchemas = new Dictionary<string, object>