Class AttachmentProperties
Represents a message attachment, and its contained data.
public class AttachmentProperties : IHttpSerializable
- Inheritance
-
AttachmentProperties
- Implements
- Derived
- Inherited Members
Constructors
AttachmentProperties(string)
Creates an empty attachment with the given filename.
protected AttachmentProperties(string fileName)
Parameters
fileNamestringName of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).
AttachmentProperties(string, Stream)
Creates an attachment from the provided stream, with the given filename.
public AttachmentProperties(string fileName, Stream stream)
Parameters
fileNamestringName of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation). streamStreamA stream containing the attachment's contents.
Properties
Description
Description for the attachment (max 1024 characters for attachments sent by message, max 200 characters for attachments used for sticker creation).
public string? Description { get; set; }
Property Value
FileName
Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).
public string FileName { get; set; }
Property Value
SupportsHttpSerialization
Whether the attachment supports HTTP serialization.
public virtual bool SupportsHttpSerialization { get; }
Property Value
Title
The title of the attachment.
public string? Title { get; set; }
Property Value
Methods
GetStream()
protected Stream? GetStream()
Returns
Serialize()
Serializes the object or its part into HttpContent.
public virtual HttpContent Serialize()
Returns
WithDescription(string?)
Description for the attachment (max 1024 characters for attachments sent by message, max 200 characters for attachments used for sticker creation).
public AttachmentProperties WithDescription(string? description)
Parameters
descriptionstring
Returns
WithFileName(string)
Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).
public AttachmentProperties WithFileName(string fileName)
Parameters
fileNamestring
Returns
WithTitle(string?)
The title of the attachment.
public AttachmentProperties WithTitle(string? title)
Parameters
titlestring
Returns
WriteTo(Utf8JsonWriter, int)
protected virtual void WriteTo(Utf8JsonWriter writer, int attachmentId)
Parameters
writerUtf8JsonWriterattachmentIdint