We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Order of LinkedResources elements

Hello,

I have a question which not far from this question :

When I do an iteration on message.LinkedResources, I see that, Aspose had an automatic ordering by file’s name. But I need to do an iteration in order of file’s position in body of the mail.

How could you help me?

@alireza.tadbir,

Thank you for contacting Aspose support team.

I have checked the documentation but could not find any option to sort the linked resources in order of file’s position in body. I am afraid that this feature is not available. Please feel free to write us back if you have any other query in this regard.

First of all, thanks for your answer.

Ok, not a problem.

I’ve resolved it in this way:

public class CIDFiles
    {
        public string Filename { get; set; }
        public int Position { get; set; }
    }

In program:

for (int w = 0; w < message.LinkedResources.Count; w++)
{
cids.Add(new CIDFiles()
{
	Filename = message.LinkedResources[w].ContentType.Name),
	Position = message.HtmlBody.IndexOf(message.LinkedResources[w].ContentType.Name)
});
}
cids = cids.OrderBy(x => x.Position).ToList();

It’s not bad to add Position Property in LinkedResources object

@alireza.tadbir,

Many thanks for sharing your code snippet with us. We haven’t received such request earlier and we’ll see if such property could be provided as part of LinkedResource. In case such an implementation is possible, we’ll update you here via this thread with the ticket id.

1 Like

Or at least, put them in order of Position…

@alireza.tadbir,

We’ll update you here once we get confirmed feedback about either of them for possible implementation.

@alireza.tadbir,

The issue has been logged as EMAILNET-38853 for further consideration by Product team. We’ll update you here once there is further information or a fix version available in this regard.

Wow! what an active support! Thanks a lot :slight_smile: