简体   繁体   English

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

[英]How to create a Google account programmatically?

Does anybody know how to create gmail account in c# (programmatically). 有谁知道如何在C#中创建Gmail帐户(以编程方式)。 I am refer this link https://developers.google.com/admin-sdk/directory/v1/guides/manage-users . 我指的是此链接https://developers.google.com/admin-sdk/directory/v1/guides/manage-users

This the code for create gmail account programmatically in c#:- 这是在C#中以编程方式创建Gmail帐户的代码:-

Step 1: You should have admin account. 步骤1:您应该拥有管理员帐户。 Use admin mailid and pwd for create gmail account. 使用admin mailid和pwd创建Gmail帐户。

step 2: login in your admin account then go into security tab -> Api Reference -> Enable Api Access. 第2步:登录您的管理员帐户,然后进入“安全”标签->“ Api参考”->“启用Api访问”。

Step 3: add Google.Gdata.Apps.dll in your project. 步骤3:在您的项目中添加Google.Gdata.Apps.dll。

Step 4: code: 步骤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();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM