Aspose::Email::LinkedResource Class Reference

Represents an embedded resource in a message. More...

Inherits Aspose::Email::AttachmentBase.

Public Member Functions

System::SharedPtr< System::Uri > get_ContentLink ()
 Gets a URI that the resource must match. More...
 
void set_ContentLink (System::SharedPtr< System::Uri > value)
 Sets a URI that the resource must match. More...
 
System::String get_Name ()
 
System::SharedPtr< Aspose::Email::Mime::ContentDispositionget_ContentDisposition ()
 Gets Content-Disposition header More...
 
 LinkedResource (System::String fileName)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::String fileName, System::String mediaType)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::String fileName, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::SharedPtr< System::IO::Stream > contentStream)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::SharedPtr< System::IO::Stream > contentStream, System::String mediaType)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::SharedPtr< System::IO::Stream > contentStream, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource ()
 Initializes a new instance of the LinkedResource class. More...
 
 LinkedResource (System::SharedPtr< Aspose::Email::Mime::MimePart > part)
 Initializes a new instance of the LinkedResource class. More...
 
System::SharedPtr< Mapi::MapiAttachmentConvertToMapiAttachment (Mapi::OutlookMessageFormat format, int32_t codePage, int32_t count, bool preserveDates) override
 
System::SharedPtr< LinkedResourceClone ()
 
- Public Member Functions inherited from Aspose::Email::AttachmentBase
System::SharedPtr< System::IO::Stream > get_ContentStream ()
 Gets the content stream. More...
 
void set_ContentStream (System::SharedPtr< System::IO::Stream > value)
 Sets the content stream. More...
 
System::String get_ContentId ()
 Gets the content id. More...
 
void set_ContentId (System::String value)
 Sets the content id. More...
 
virtual System::SharedPtr< Mime::HeaderCollectionget_Headers ()
 Gets headers collection of attachment. More...
 
System::SharedPtr< Aspose::Email::Mime::ContentTypeget_ContentType ()
 Gets the type of the content. More...
 
void set_ContentType (System::SharedPtr< Aspose::Email::Mime::ContentType > value)
 Sets the type of the content. More...
 
Aspose::Email::Mime::TransferEncoding get_TransferEncoding ()
 Gets the transfer encoding. More...
 
void set_TransferEncoding (Aspose::Email::Mime::TransferEncoding value)
 Sets the transfer encoding. More...
 
System::SharedPtr< System::Uri > get_ContentLocation () const
 Gets the content location. More...
 
void set_ContentLocation (System::SharedPtr< System::Uri > value)
 Sets the content location. More...
 
System::String get_ItemId () const
 
void set_ItemId (System::String value)
 
System::SharedPtr< Aspose::Email::Mime::MimePart > get_MimePart () const
 Gets the MIME part. More...
 
void set_MimePart (System::SharedPtr< Aspose::Email::Mime::MimePart > value)
 Sets the MIME part. More...
 
bool get_Hidden ()
 
void set_Hidden (bool value)
 
virtual void SaveInternal (System::SharedPtr< System::IO::Stream > stream)
 Saves the specified stream. More...
 
virtual void Save (System::SharedPtr< System::IO::Stream > stream)
 Saves the specified stream. More...
 
virtual void Save (System::String fileName)
 Saves the specified file name. More...
 
void SetContentFromString (System::String contentString, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Sets the content from string. More...
 
void SetContentFromString (System::String contentString, System::SharedPtr< System::Text::Encoding > encoding, System::String mediaType)
 Sets the content from string. More...
 
void SetContentFromString (System::String contentString, System::SharedPtr< System::Text::Encoding > encoding, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType, Aspose::Email::Mime::TransferEncoding te)
 Sets the content from string. More...
 
void SetSTnefContent (System::ArrayPtr< uint8_t > data)
 Sets the S/TNEF content. More...
 
virtual void PrepareForSending ()
 Prepares for sending. More...
 
void Dispose () override
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Static Public Member Functions

static System::SharedPtr< LinkedResourceCreateLinkedResourceFromString (System::String content)
 Creates the linked resource from string. More...
 
static System::SharedPtr< LinkedResourceCreateLinkedResourceFromString (System::String content, System::SharedPtr< System::Text::Encoding > contentEncoding, System::String mediaType)
 Creates the linked resource from string. More...
 
static System::SharedPtr< LinkedResourceCreateLinkedResourceFromString (System::String content, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Creates the linked resource from string. More...
 

Friends

class Aspose::Email::AlternateView
 
class Aspose::Email::MailMessage
 
class Aspose::Email::Clients::Graph::V1::Model::TLAttachment
 
class Aspose::Email::Mapi::MailMessageInterpretor
 
class Aspose::Email::Mapi::MapiMessage
 
class Aspose::Email::Tools::ResponseMessageBuilder
 

Additional Inherited Members

- Public Attributes inherited from Aspose::Email::AttachmentBase
bool Disposed
 Is disposed. More...
 
int32_t TnefAttachIndex
 
- Protected Member Functions inherited from Aspose::Email::AttachmentBase
 AttachmentBase ()
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::SharedPtr< System::IO::Stream > contentStream, System::String name, System::String mediaType)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::String fileName)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::String fileName, System::String mediaType)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::String fileName, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::SharedPtr< System::IO::Stream > contentStream)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::SharedPtr< System::IO::Stream > contentStream, System::String mediaType)
 Initializes a new instance of the AttachmentBase class. More...
 
 AttachmentBase (System::SharedPtr< System::IO::Stream > contentStream, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Initializes a new instance of the AttachmentBase class. More...
 
virtual System::String GenerateContentId ()
 Generates the content id value. More...
 
virtual void Dispose (bool disposing)
 Releases unmanaged and - optionally - managed resources. More...
 
virtual ~AttachmentBase ()
 
- Static Protected Member Functions inherited from Aspose::Email::AttachmentBase
static System::SharedPtr< System::Text::Encoding > GetEncodingFromContent (System::String contentString, System::SharedPtr< Aspose::Email::Mime::ContentType > contentType)
 Defines Encoding from content. More...
 

Detailed Description

Represents an embedded resource in a message.

The following example shows how to embed objects using LinkedResource into an Email.

[C#]

var eml = new MailMessage
{
From = "AndrewIrwin@from.com",
To = "SusanMarc@to.com",
Subject = "This is an email"
};
// Create the plain text part It is viewable by those clients that don't support HTML
var plainView =
AlternateView.CreateAlternateViewFromString("This is my plain text content", null, "text/plain");
// Create the HTML part.To embed images, we need to use the prefix 'cid' in the img src value.
// The cid value will map to the Content-Id of a Linked resource. Thus <img src='cid:barcode'>
// will map to a LinkedResource with a ContentId of 'barcode'.
var htmlView =
AlternateView.CreateAlternateViewFromString("Here is an embedded image.<img src=cid:barcode>", null,
"text/html");
// Create the LinkedResource (embedded image) and Add the LinkedResource to the appropriate view
var barcode = new LinkedResource("1.jpg", MediaTypeNames.Image.Jpeg)
{
ContentId = "barcode"
};
eml.LinkedResources.Add(barcode);
eml.AlternateViews.Add(plainView);
eml.AlternateViews.Add(htmlView);
eml.Save("EmbeddedImage_out.msg", SaveOptions.DefaultMsgUnicode);

[Visual Basic]

Dim eml = New MailMessage With {
.From = "AndrewIrwin@from.com",
.[To] = "SusanMarc@to.com",
.Subject = "This is an email"
}
' Create the plain text part It is viewable by those clients that don't support HTML
Dim plainView = AlternateView.CreateAlternateViewFromString("This is my plain text content", Nothing, "text/plain")
' Create the HTML part.To embed images, we need to use the prefix 'cid' in the img src value.
' The cid value will map to the Content-Id of a Linked resource. Thus <img src='cid:barcode'>
' will map to a LinkedResource with a ContentId of 'barcode'.
Dim htmlView = AlternateView.CreateAlternateViewFromString("Here is an embedded image.<img src=cid:barcode>", Nothing, "text/html")
' Create the LinkedResource (embedded image) and Add the LinkedResource to the appropriate view
Dim barcode = New LinkedResource("1.jpg", MediaTypeNames.Image.Jpeg) With {
.ContentId = "barcode"
}
eml.LinkedResources.Add(barcode)
eml.AlternateViews.Add(plainView)
eml.AlternateViews.Add(htmlView)
eml.Save("EmbeddedImage_out.msg", SaveOptions.DefaultMsgUnicode)

Constructor & Destructor Documentation

◆ LinkedResource() [1/8]

Aspose::Email::LinkedResource::LinkedResource ( System::String  fileName)

Initializes a new instance of the LinkedResource class.

Parameters
fileNameThe file name that holds the content for this resource.

◆ LinkedResource() [2/8]

Aspose::Email::LinkedResource::LinkedResource ( System::String  fileName,
System::String  mediaType 
)

Initializes a new instance of the LinkedResource class.

Parameters
fileNameThe file name that holds the content for this resource.
mediaTypeInternet media type.

◆ LinkedResource() [3/8]

Aspose::Email::LinkedResource::LinkedResource ( System::String  fileName,
System::SharedPtr< Aspose::Email::Mime::ContentType contentType 
)

Initializes a new instance of the LinkedResource class.

Parameters
fileNameThe file name that holds the content for this resource.
contentTypeThe type of content.

◆ LinkedResource() [4/8]

Aspose::Email::LinkedResource::LinkedResource ( System::SharedPtr< System::IO::Stream >  contentStream)

Initializes a new instance of the LinkedResource class.

Parameters
contentStreamA stream that contains the content for this resource.

◆ LinkedResource() [5/8]

Aspose::Email::LinkedResource::LinkedResource ( System::SharedPtr< System::IO::Stream >  contentStream,
System::String  mediaType 
)

Initializes a new instance of the LinkedResource class.

Parameters
contentStreamA stream that contains the content for this resource.
mediaTypeInternet media type.

◆ LinkedResource() [6/8]

Aspose::Email::LinkedResource::LinkedResource ( System::SharedPtr< System::IO::Stream >  contentStream,
System::SharedPtr< Aspose::Email::Mime::ContentType contentType 
)

Initializes a new instance of the LinkedResource class.

Parameters
contentStreamA stream that contains the content for this resource.
contentTypeThe type of content.

◆ LinkedResource() [7/8]

Aspose::Email::LinkedResource::LinkedResource ( )

Initializes a new instance of the LinkedResource class.

◆ LinkedResource() [8/8]

Aspose::Email::LinkedResource::LinkedResource ( System::SharedPtr< Aspose::Email::Mime::MimePart >  part)

Initializes a new instance of the LinkedResource class.

Parameters
partAn linked resource mime part
Exceptions
ArgumentNullExceptionpart is null

Member Function Documentation

◆ Clone()

System::SharedPtr<LinkedResource> Aspose::Email::LinkedResource::Clone ( )

◆ ConvertToMapiAttachment()

System::SharedPtr<Mapi::MapiAttachment> Aspose::Email::LinkedResource::ConvertToMapiAttachment ( Mapi::OutlookMessageFormat  format,
int32_t  codePage,
int32_t  count,
bool  preserveDates 
)
overridevirtual

◆ CreateLinkedResourceFromString() [1/3]

static System::SharedPtr<LinkedResource> Aspose::Email::LinkedResource::CreateLinkedResourceFromString ( System::String  content)
static

Creates the linked resource from string.

Parameters
contentA string that contains the resource to be included in the email attachment.
Returns
A LinkedResource object that contains the embedded resource.

◆ CreateLinkedResourceFromString() [2/3]

static System::SharedPtr<LinkedResource> Aspose::Email::LinkedResource::CreateLinkedResourceFromString ( System::String  content,
System::SharedPtr< Aspose::Email::Mime::ContentType contentType 
)
static

Creates the linked resource from string.

Parameters
contentA string that contains the resource to be included in the email attachment.
contentTypeThe type of the content.
Returns
A LinkedResource object that contains the embedded resource.

◆ CreateLinkedResourceFromString() [3/3]

static System::SharedPtr<LinkedResource> Aspose::Email::LinkedResource::CreateLinkedResourceFromString ( System::String  content,
System::SharedPtr< System::Text::Encoding >  contentEncoding,
System::String  mediaType 
)
static

Creates the linked resource from string.

Parameters
contentA string that contains the resource to be included in the email attachment.
contentEncodingThe content encoding.
mediaTypeThe MIME media type of the content.
Returns
A LinkedResource object that contains the embedded resource.

◆ get_ContentDisposition()

System::SharedPtr<Aspose::Email::Mime::ContentDisposition> Aspose::Email::LinkedResource::get_ContentDisposition ( )

Gets Content-Disposition header

◆ get_ContentLink()

System::SharedPtr<System::Uri> Aspose::Email::LinkedResource::get_ContentLink ( )

Gets a URI that the resource must match.

◆ get_Name()

System::String Aspose::Email::LinkedResource::get_Name ( )

◆ set_ContentLink()

void Aspose::Email::LinkedResource::set_ContentLink ( System::SharedPtr< System::Uri >  value)

Sets a URI that the resource must match.

Friends And Related Function Documentation

◆ Aspose::Email::AlternateView

friend class Aspose::Email::AlternateView
friend

◆ Aspose::Email::Clients::Graph::V1::Model::TLAttachment

friend class Aspose::Email::Clients::Graph::V1::Model::TLAttachment
friend

◆ Aspose::Email::MailMessage

friend class Aspose::Email::MailMessage
friend

◆ Aspose::Email::Mapi::MailMessageInterpretor

friend class Aspose::Email::Mapi::MailMessageInterpretor
friend

◆ Aspose::Email::Mapi::MapiMessage

friend class Aspose::Email::Mapi::MapiMessage
friend

◆ Aspose::Email::Tools::ResponseMessageBuilder

LinkedResource()
Initializes a new instance of the LinkedResource class.
@ Arrival
By internal date and time of the message. This differs from the ON criteria in SEARCH,...