AddFileAttachmentWithStream method

FileAttachment AddFileAttachmentWithStream(
  1. String name,
  2. Stream contentStream
)
Adds a file attachment to the collection. The name of the file representing the content of the attachment. Adds a file attachment to the collection. The display name of the new attachment. The name of the file representing the content of the attachment. Adds a file attachment to the collection. The display name of the new attachment. The stream from which to read the content of the attachment.

Implementation

// FileAttachment AddFileAttachment(String fileName)
//        {
//            return this.AddFileAttachment(Path.GetFileName(fileName), fileName);
//        }

/// <summary>
/// Adds a file attachment to the collection.
/// </summary>
/// <param name="name">The display name of the new attachment.</param>
/// <param name="fileName">The name of the file representing the content of the attachment.</param>
/// <returns>A FileAttachment instance.</returns>
// FileAttachment AddFileAttachment(String name, String fileName)
//        {
//            FileAttachment fileAttachment = new FileAttachment.withOwner(this.owner);
//            fileAttachment.Name = name;
//            fileAttachment.FileName = fileName;
//
//            this.InternalAdd(fileAttachment);
//
//            return fileAttachment;
//        }

/// <summary>
/// Adds a file attachment to the collection.
/// </summary>
/// <param name="name">The display name of the new attachment.</param>
/// <param name="contentStream">The stream from which to read the content of the attachment.</param>
/// <returns>A FileAttachment instance.</returns>
FileAttachment AddFileAttachmentWithStream(
    String name, Stream contentStream) {
  FileAttachment fileAttachment = new FileAttachment.withOwner(this._owner!);
  fileAttachment.Name = name;
  fileAttachment.ContentStream = contentStream as Stream<List<int>>?;

  this.InternalAdd(fileAttachment);

  return fileAttachment;
}