Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Google account programmatically?

Does anybody know how to create gmail account in c# (programmatically). I am refer this link https://developers.google.com/admin-sdk/directory/v1/guides/manage-users.

like image 299
Anurag Jain Avatar asked Oct 21 '25 19:10

Anurag Jain


1 Answers

This the code for create gmail account programmatically in c#:-

Step 1: You should have admin account. Use admin mailid and pwd for create gmail account.

step 2: login in your admin account then go into security tab -> Api Reference -> Enable Api Access.

Step 3: add Google.Gdata.Apps.dll in your project.

Step 4: code:

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();
}
like image 179
Anurag Jain Avatar answered Oct 24 '25 07:10

Anurag Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!