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.
Asked
Active
Viewed 8,267 times
3
-
I generated apikey successfully but I am not able create http request. – Anurag Jain Oct 08 '13 at 12:01
-
as above. bit of advise though, start with httpwebrequest – Daniel Casserly Oct 08 '13 at 12:02
-
ok, is there we need to add any reference in project. – Anurag Jain Oct 08 '13 at 12:03
-
I hope this isn't going to be used to create spam accounts. Is it? – Sam Oct 08 '13 at 12:06
-
no, but I am stuck with creating web request. – Anurag Jain Oct 08 '13 at 12:11
-
@AnuragJain Is [this](http://stackoverflow.com/a/10027534/2246344) what you were looking for? – Sam Oct 08 '13 at 12:22
-
Create google account programmatically but when I send httpwebrequest, it's not working. – Anurag Jain Oct 08 '13 at 12:25
-
these is my POST request :- string URl = service + "?&type=xml" + "&APIKey=" + APIKey + "&UserName=" + UserName + "&GivenName=" + GivenName + "&FamilyName=" + FamilyName + "&Password=" + Password; – Anurag Jain Oct 08 '13 at 12:26
-
any final solution with full source code sample working about it ? – Kiquenet Oct 24 '13 at 08:42
-
I post the code Please check it. If u think this code is useful for u please mark as my answer. – Anurag Jain Oct 24 '13 at 15:07
-
Duplicate of [Can I create a Google account programmatically?](http://stackoverflow.com/questions/2699008/can-i-create-a-google-account-programmatically) - You need the Google Apps Provisioning Api – Basic Jan 05 '14 at 13:03
-
@Basic Thanks for reply, I all ready post the answer. – Anurag Jain Jan 06 '14 at 13:31
1 Answers
5
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();
}

Marco
- 56,740
- 14
- 129
- 152

Anurag Jain
- 1,371
- 4
- 23
- 34