public class

MailItemService

extends MediaService
java.lang.Object
   ↳ com.google.gdata.client.Service
     ↳ com.google.gdata.client.GoogleService
       ↳ com.google.gdata.client.media.MediaService
         ↳ com.google.gdata.client.appsforyourdomain.migration.MailItemService

Class Overview

The MailItemService class is a MediaService that can upload mail to the Google Apps Email Migration API.

The recommended way to perform mail migration is to issue multipart POST requests, where the first part contains an Atom entry specifying the message properties and labels, and the second part contains the complete RFC822 message as UTF-8 text.

Summary

Nested Classes
class MailItemService.Versions  
Constants
String APPS_APIS_DOMAIN Domain for sending API requests.
String URL_PREFIX URL prefix for accessing migration feeds.
String URL_SUFFIX URL suffix for the mail item batch feed.
[Expand]
Inherited Constants
From class com.google.gdata.client.media.MediaService
Fields
public static final Version DEFAULT_VERSION Version 1 is the current default version for MailItemService.
[Expand]
Inherited Fields
From class com.google.gdata.client.media.MediaService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
Public Constructors
MailItemService(String applicationName)
Constructs a MailItemService instance for an application with the name applicationName.
MailItemService(String applicationName, String protocol, String domainName)
Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName.
Public Methods
MailItemFeed batch(String domain, String userName, MailItemFeed feed)
Inserts one or more MailItem entries in a single batch operation.
[Expand]
Inherited Methods
From class com.google.gdata.client.media.MediaService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
From class java.lang.Object
From interface com.google.gdata.client.AuthTokenFactory.TokenListener

Constants

public static final String APPS_APIS_DOMAIN

Domain for sending API requests.

Constant Value: "apps-apis.google.com"

public static final String URL_PREFIX

URL prefix for accessing migration feeds.

Constant Value: "/a/feeds/migration/2.0"

public static final String URL_SUFFIX

URL suffix for the mail item batch feed.

Constant Value: "/mail/batch"

Fields

public static final Version DEFAULT_VERSION

Version 1 is the current default version for MailItemService.

Public Constructors

public MailItemService (String applicationName)

Constructs a MailItemService instance for an application with the name applicationName.

Parameters
applicationName The name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.

public MailItemService (String applicationName, String protocol, String domainName)

Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName. The service will authenticate at the provided domainName.

Parameters
applicationName The name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.
protocol Name of protocol to use for authentication ("http"/"https")
domainName The name of the domain hosting the login handler

Public Methods

public MailItemFeed batch (String domain, String userName, MailItemFeed feed)

Inserts one or more MailItem entries in a single batch operation. Using batch instead of repeated calls to insert is helpful in reducing HTTP overhead.

Parameters
domain The domain into which mail is being migrated
userName
feed A feed containing one or more MailItemEntry objects, each of which has been tagged with BatchUtils#setBatchId(com.google.gdata.data.BaseEntry, String). The batch operation type of each entry must be BatchOperationType.INSERT; however, there should be no need to call BatchUtils.setBatchOperationType on each entry, as this operation is already the default.
Returns
  • a feed with the result of each operation in a separate MailItemEntry object.
Throws
IOException if an error occurs while communicating with the GData service.
MalformedURLException if the batch feed URL cannot be constructed.
ServiceException if the insert request failed due to system error.
BatchInterruptedException if an irrecoverable error was detected by the server while parsing the request, like invalid XML data. Some operations might have succeeded when this exception is thrown. Check getFeed().