google email settings api send as alias

207 views Asked by At

I'm getting an error when trying to create a sendas alias using the Email Settings API for C#. Here's my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;


namespace EmailSettings
{
    class Program
    {
        static void Main(string[] args)
        {
            GoogleMailSettingsService service = new GoogleMailSettingsService("domain.com", "apps");
            service.setUserCredentials("[email protected]", "pwd");

            service.CreateSendAs("username", "FriendlyAlias", "[email protected]", "", "true");
        }
    }
}

I'm getting the following error "{"Execution of request failed: https://apps-apis.google.com/a/feeds/emailsettings/2.0/domain.com/username/sendas"}"

the inner exception is {"The remote server returned an error: (400) Bad Request."}

0

There are 0 answers