如何以编程方式创建Google帐户?

时间:2013-10-08 11:59:27

标签: c# google-api

有人知道如何在c#中创建gmail帐户(以编程方式)。我推荐此链接https://developers.google.com/admin-sdk/directory/v1/guides/manage-users

1 个答案:

答案 0 :(得分:5)

这是在c#: -

中以编程方式创建gmail帐户的代码

第1步:您应该拥有管理员帐户。使用admin mailid和pwd创建gmail帐户。

第2步:在您的管理员帐户中登录,然后进入安全标签 - > Api参考 - >启用Api访问。

第3步:在您的项目中添加Google.Gdata.Apps.dll。

第4步:代码:

using Google.GData.Apps;

AppsService appService = new AppsService("example.com","mailid","Password");

try
{
    var a = appService.CreateUser(UserName,GivenName,FamilyName,Password);
}
catch (AppsException ex)
{
    response = ex.Reason.ToString() + " " + ex.ErrorCode.ToString();
}
相关问题