Show / Hide Table of Contents

Class UsersResource.MessagesResource

The "messages" collection of methods.

Inheritance
object
UsersResource.MessagesResource
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Google.Apis.Gmail.v1
Assembly: Google.Apis.Gmail.v1.dll
Syntax
public class UsersResource.MessagesResource

Constructors

MessagesResource(IClientService)

Constructs a new resource.

Declaration
public MessagesResource(IClientService service)
Parameters
Type Name Description
IClientService service

Properties

Attachments

Gets the Attachments resource.

Declaration
public virtual UsersResource.MessagesResource.AttachmentsResource Attachments { get; }
Property Value
Type Description
UsersResource.MessagesResource.AttachmentsResource

Methods

BatchDelete(BatchDeleteMessagesRequest, string)

Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.

Declaration
public virtual UsersResource.MessagesResource.BatchDeleteRequest BatchDelete(BatchDeleteMessagesRequest body, string userId)
Parameters
Type Name Description
BatchDeleteMessagesRequest body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.BatchDeleteRequest

BatchModify(BatchModifyMessagesRequest, string)

Modifies the labels on the specified messages.

Declaration
public virtual UsersResource.MessagesResource.BatchModifyRequest BatchModify(BatchModifyMessagesRequest body, string userId)
Parameters
Type Name Description
BatchModifyMessagesRequest body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.BatchModifyRequest

Delete(string, string)

Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.

Declaration
public virtual UsersResource.MessagesResource.DeleteRequest Delete(string userId, string id)
Parameters
Type Name Description
string userId

The user's email address. The special value me can be used to indicate the authenticated user.

string id

The ID of the message to delete.

Returns
Type Description
UsersResource.MessagesResource.DeleteRequest

Get(string, string)

Gets the specified message.

Declaration
public virtual UsersResource.MessagesResource.GetRequest Get(string userId, string id)
Parameters
Type Name Description
string userId

The user's email address. The special value me can be used to indicate the authenticated user.

string id

The ID of the message to retrieve. This ID is usually retrieved using messages.list. The ID is also contained in the result when a message is inserted (messages.insert) or imported (messages.import).

Returns
Type Description
UsersResource.MessagesResource.GetRequest

Import(Message, string)

Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn't perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message.

Declaration
public virtual UsersResource.MessagesResource.ImportRequest Import(Message body, string userId)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.ImportRequest

Import(Message, string, Stream, string)

Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn't perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message.

Declaration
public virtual UsersResource.MessagesResource.ImportMediaUpload Import(Message body, string userId, Stream stream, string contentType)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Stream stream

The stream to upload. See remarks for further information.

string contentType

The content type of the stream to upload.

Returns
Type Description
UsersResource.MessagesResource.ImportMediaUpload
Remarks

Considerations regarding stream:

  • If stream is seekable, then the stream position will be reset to 0 before reading commences. If stream is not seekable, then it will be read from its current position
  • Caller is responsible for maintaining the stream open until the upload is completed
  • Caller is responsible for closing the stream

Insert(Message, string)

Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

Declaration
public virtual UsersResource.MessagesResource.InsertRequest Insert(Message body, string userId)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.InsertRequest

Insert(Message, string, Stream, string)

Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

Declaration
public virtual UsersResource.MessagesResource.InsertMediaUpload Insert(Message body, string userId, Stream stream, string contentType)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Stream stream

The stream to upload. See remarks for further information.

string contentType

The content type of the stream to upload.

Returns
Type Description
UsersResource.MessagesResource.InsertMediaUpload
Remarks

Considerations regarding stream:

  • If stream is seekable, then the stream position will be reset to 0 before reading commences. If stream is not seekable, then it will be read from its current position
  • Caller is responsible for maintaining the stream open until the upload is completed
  • Caller is responsible for closing the stream

List(string)

Lists the messages in the user's mailbox.

Declaration
public virtual UsersResource.MessagesResource.ListRequest List(string userId)
Parameters
Type Name Description
string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.ListRequest

Modify(ModifyMessageRequest, string, string)

Modifies the labels on the specified message.

Declaration
public virtual UsersResource.MessagesResource.ModifyRequest Modify(ModifyMessageRequest body, string userId, string id)
Parameters
Type Name Description
ModifyMessageRequest body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

string id

The ID of the message to modify.

Returns
Type Description
UsersResource.MessagesResource.ModifyRequest

Send(Message, string)

Sends the specified message to the recipients in the To, Cc, and Bcc headers. For example usage, see Sending email.

Declaration
public virtual UsersResource.MessagesResource.SendRequest Send(Message body, string userId)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Returns
Type Description
UsersResource.MessagesResource.SendRequest

Send(Message, string, Stream, string)

Sends the specified message to the recipients in the To, Cc, and Bcc headers. For example usage, see Sending email.

Declaration
public virtual UsersResource.MessagesResource.SendMediaUpload Send(Message body, string userId, Stream stream, string contentType)
Parameters
Type Name Description
Message body

The body of the request.

string userId

The user's email address. The special value me can be used to indicate the authenticated user.

Stream stream

The stream to upload. See remarks for further information.

string contentType

The content type of the stream to upload.

Returns
Type Description
UsersResource.MessagesResource.SendMediaUpload
Remarks

Considerations regarding stream:

  • If stream is seekable, then the stream position will be reset to 0 before reading commences. If stream is not seekable, then it will be read from its current position
  • Caller is responsible for maintaining the stream open until the upload is completed
  • Caller is responsible for closing the stream

Trash(string, string)

Moves the specified message to the trash.

Declaration
public virtual UsersResource.MessagesResource.TrashRequest Trash(string userId, string id)
Parameters
Type Name Description
string userId

The user's email address. The special value me can be used to indicate the authenticated user.

string id

The ID of the message to Trash.

Returns
Type Description
UsersResource.MessagesResource.TrashRequest

Untrash(string, string)

Removes the specified message from the trash.

Declaration
public virtual UsersResource.MessagesResource.UntrashRequest Untrash(string userId, string id)
Parameters
Type Name Description
string userId

The user's email address. The special value me can be used to indicate the authenticated user.

string id

The ID of the message to remove from Trash.

Returns
Type Description
UsersResource.MessagesResource.UntrashRequest
In This Article
Back to top Generated by DocFX