Wednesday, April 27, 2016

How to Control Export of Hidden Visio Pages to PDF HTML Image & Other Formats using .NET

This tutorial shows how .NET developers can Control the Export of Hidden Visio Pages on Saving inside .NET applications inside their .NET applications. Aspose.Diagram for .NET API allows developers to include or exclude hidden Visio pages on saving diagram to PDF, HTML, Image (PNG, JPEG, GIF), SVG, and XPS files. Even they may hide Visio pages using Aspose.Diagram API because it's option is already available through the cell UIVisibility in the page ShapeSheet. Aspose.Diagram for .NET API has the Page class that represents a Visio drawing page. The PageSheet property exposed by the Page class also exposes the page properties. The {{UIVisibility }}field of the page properties allows to hide the page. Developers can then use ExportHiddenPage property which is added in the SVGSaveOptions, XPSSaveOptions, ImageSaveOptions, HTMLSaveOptions and PdfSaveOptions classes. These examples show how to:
  • Set the Export Option for PDF.
  • Set the Export Option for HTML.
  • Set the Export Option for Image.
  • Set the Export Option for SVG.
  • Set the Export Option for XPS.
//Set the Export Option for PDF
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
PdfSaveOptions options = new PdfSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.pdf", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New PdfSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.pdf"), options)
//Set the Export Option for HTML
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
HTMLSaveOptions options = new HTMLSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.html", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New HTMLSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.html"), options)
//Set the Export Option for Image
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.jpeg", options);

// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New ImageSaveOptions(SaveFileFormat.JPEG)
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.jpeg"), options)


//Set the Export Option for SVG
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
SVGSaveOptions options = new SVGSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.svg", options);


// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New SVGSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.svg"), options)
//Set the Export Option for XPS
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
XPSSaveOptions options = new XPSSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.xps", options);


// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New XPSSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.xps"), options)

Overview: Aspose.Diagram for .NET

Aspose.Diagram is a class library for working with MS Visio files & is a pure Java alternate for MS Visio Object Model. It is a standalone Visio Java library and does not depend on Microsoft Office Visio. It enables developers to work with VSD & VDX files and they can open files & Add   & manipulate the elements of the diagram, export Visio files to PDF, XML, HTML, images format, SVG & several other formats,  Rotate a shape, Add a hyperlink to a Visio shape, protect diagram shape and many more.  Aspose.Diagram can be used with any kind of application, whether it’s a Web Application or a Windows Desktop Application.

Thursday, September 11, 2014

How to Load an Existing Email Message & Modify its Contents in Java Apps



This technical tip shows how to java developers can load and modify an existingemail message inside their java application using Aspose.Email Java API.  Aspose.Email API allows developer to load any existing email message and modify its contents before saving back to the disk. One notable point is to specify the MessageFormat while loading the email message from the disk. In addition, it is important to specify the correct MailMessageSaveType while saving the message back to disk.

The following sequence of steps lets you modify an existing email message:

·         Create an instance of the MailMessage class.
·         Load an existing message using the MailMessage class' load(), specifying the email' MessageFormat.
·         Get the subject using the getSubject() method, modify it and set it using the MailMessage class' setSubject() method.
·         Get the body using the getHtmlBody() method, modify it and set it using the MailMessage class' setHtmlBody() method.
·         Create an instance of the MailAddressCollection class.
·         Get recipients from the TO field into the MailAddressCollection object using the MailMessage class' getTo() method.
·         Add or remove recipients using the MailAddressCollection collection's add() and remove() methods.
·         Get recipients from the CC field into the MailAddressCollection object using the MailMessage class' getCC() method.
·         Add or remove recipients using the MailAddressCollection collection's add() and remove() methods.
·         Call the MailMessage class' save() method to save the file to disk in MSG format by specifying the correct MailMessageSaveType.

//Adding Attachments to a New Email Message

public static void main(String[] args)
{
    // Base folder for reading and writing files
    String strBaseFolder = "D:\\Data\\Aspose\\resources\\";

    //Initialize and Load an existing MSG file by specifying the MessageFormat
    MailMessage email = MailMessage.load(strBaseFolder + "anEmail.msg", MessageFormat.getMsg());

    //Initialize a String variable to get the Email Subject
    String subject = email.getSubject();
    //Append some more information to Subject
    subject = subject + " This text is added to the existing subject";
    //Set the Email Subject
    email.setSubject(subject);

    //Initialize a String variable to get the Email's HTML Body
    String body = email.getHtmlBody();
    //Apppend some more information to the Body variable
    body = body + "<br> This text is added to the existing body";
    //Set the Email Body
    email.setHtmlBody(body);

    //Initialize MailAddressCollection object
    MailAddressCollection contacts = new MailAddressCollection();

    //Retrieve Email's TO list
    contacts = email.getTo();
    //Check if TO list has some values
    if (contacts.size() > 0)
    {
        //Remove the first email address
        contacts.remove(0);
        //Add another email address to collection
        contacts.add("to1@domain.com");
    }
    //Set the collection as Email's TO list
    email.setTo(contacts);

    //Initialize MailAddressCollection
    contacts = new MailAddressCollection();

    //Retrieve Email's CC list
    contacts = email.getCC();
    //Add another email address to collection
    contacts.add("cc2@domain.com");
    //Set the collection as Email's CC list
    email.setCC(contacts);

    //Save the Email message to disk by specifying the MessageFormat
    email.save(strBaseFolder + "message.msg", MailMessageSaveType.getOutlookMessageFormat());
}

//Loading a Message with Load Options

//To load a message with specific load options, Aspose.Email provides the MessageLoadOptions class that can be used as follow:

MesageLoadOptions options = new MesageLoadOptions();
options.PrefferedTextEncoding = Encoding.getEncoding(1252);
options.setMessageFormat(MessageFormat.getMsg());
MailMessage eml = MailMessage.Load("EMAIL_497563\\test3.msg", options);

Tuesday, June 3, 2014

How to Create & Send Email Message with Voting Options inside .NET Apps

This technical tip explains how to create & send an email message with voting options inside .NET Applications. Microsoft Outlook allows users to create a poll when composed a new message. This is done by including voting options such as Yes, No, Maybe, etc. The FollowUpOptions class offered by Aspose.Email, provides the VotingButtons property that can be used to set or get the value of the voting options. This article provides a detailed example of creating a MapiMessage with voting options for creating a poll and then sending the message using Exchange Web Service (EWS) client.
Creating and Sending a Message with Voting Options
The following code sample shows how to create a new message and then send it with voting options.
[C#]
string address = "firstname.lastname@aspose.com";
using (IEWSClient client = EWSClient.GetEWSClient("https://exchange.aspose.com/ews/Exchange.asmx", "username", "password", "aspose.com"))
{
    MailMessage message = CreateTestMessage(address);
    FollowUpOptions options = new FollowUpOptions();
    options.VotingButtons = "Yes;No;Maybe;Exactly!";
    client.Send(message, options);
}

 
[VB.NET]
Dim address As String = "firstname.lastname@aspose.com"
Using client As IEWSClient = EWSClient.GetEWSClient("https://exchange.aspose.com/ews/Exchange.asmx", "username", "password", "aspose.com")
      Dim message As MailMessage = CreateTestMessage(address)
      Dim options As New FollowUpOptions()
      options.VotingButtons = "Yes;No;Maybe;Exactly!"
      client.Send(message, options)
End Using
Sample Methods Used in Examples
[C#]
private static MailMessage CreateTestMessage(string address)
{
    MailMessage eml = new MailMessage(
        address,
        address,
        "Flagged message",
        "Make it nice and short, but descriptive. The description may appear in search engines' search results pages...");
    return eml;
}

 
[VB.NET]
private static MailMessage CreateTestMessage(string address)
{
    MailMessage eml = new MailMessage(
        address,
        address,
        "Flagged message",
        "Make it nice and short, but descriptive. The description may appear in search engines' search results pages...");
    return eml;
}
Overview: Aspose.Email for .NET

Aspose.Email for .NET is a set of components allowing developers to easily implement email functionality within their ASP.NET web applications, web services & Windows applications. It Supports Outlook PST, EML, MSG & MHT formats. It allows developers to work with SMTP, POP3, FTP & MS Exchange servers. It supports mail merge, iCalendar, customized header & body, header information, embedded files, Twitter & many more. It makes it easy to work with HTML or plain text emails & their attachments.

Tuesday, May 13, 2014

How to Create Reply, Reply All & Forward Email Messages from MSG Using C# & VB.NET

This technical tip explains how .NET developers can create RE (Reply/Reply All) and FW (Forward) email messages from a source message inside their .NET applications using Aspose.Email for .NET. IEWSClient lets developers create RE (Reply/Reply All) and FW (Forward) messages from a source message. The source message is identified by selecting a particular ExchangeMessageInfo from ExchangeMessageInfoCollection obtained by IEWSClient.ListMessages(). The other argument is the actual MailMessage to be sent as RE or FW message. In the following example, a sample account is used to send a message and then the Reply and Forward message features are demonstrated against that sample message.
To perform this task:
  • Initialize the IEWSClient object by providing valid credentials.
  • Send a few sample messages.
  • Call the IEWSClient.Reply(), IEWSClient.ReplyAll() and IEWSClient.Forward() functions to send messages
The sample code below creates RE (Reply/Reply All) and FW (Forward) messages from a source message.
[C# Code Sample]
public static IEWSClient GetEWSClient()
{
    const string mailboxUri = "https://exchange.domain.com/ews/Exchange.asmx";
    const string domain = @"";
    const string username = @"username";
    const string password = @"password";
    NetworkCredential credential = new NetworkCredential(username, password, domain);
    IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credential);
    return client;
}
public static void TestMailReFw()
{
    using (IEWSClient client = GetAsposeEWSClient2())
    {
        try
        {
            MailMessage message = new MailMessage(
                "user@domain.com",
                "user@domain.com",
                "TestMailRefw - " + Guid.NewGuid().ToString(),
                "TestMailRefw Implement ability to create RE and FW messages from source MSG file");
            client.Send(message);
            // Wait for a while
            ExchangeMessageInfoCollection messageInfoCol = client.ListMessages(client.MailboxInfo.InboxUri);
            if(messageInfoCol.Count == 1)
                Console.WriteLine("1 message in Inbox");
            else
                Console.WriteLine("Error! No message in Inbox");
            MailMessage message1 = new MailMessage(
                "user@domain.com",
                "user@domain.com",
                "TestMailRefw - " + Guid.NewGuid().ToString(),
                "TestMailRefw Implement ability to create RE and FW messages from source MSG file");
            client.Send(message1);
            // Wait for a while
            messageInfoCol = client.ListMessages(client.MailboxInfo.InboxUri);
            if(messageInfoCol.Count == 2)
                Console.WriteLine("2 messages in Inbox");
            else
                Console.WriteLine("Error! No new message in Inbox");

            MailMessage message2 = new MailMessage(
                "user@domain.com",
                "user@domain.com",
                "TestMailRefw - " + Guid.NewGuid().ToString(),
                "TestMailRefw Implement ability to create RE and FW messages from source MSG file");
            message2.Attachments.Add(Attachment.CreateAttachmentFromString("Test attachment 1", "Attachment Name 1"));
            message2.Attachments.Add(Attachment.CreateAttachmentFromString("Test attachment 2", "Attachment Name 2"));
            client.Reply(message2, messageInfoCol[0]);
            client.ReplyAll(message2, messageInfoCol[0]);
            client.Forward(message2, messageInfoCol[0]);
        }
        catch(Exception ex)
        {
            Console.WriteLine("Error in program");
        }
    }
}
[VB.NET Code Sample]
Public Shared Function GetEWSClient() As IEWSClient
            Const  mailboxUri As String = "https://exchange.domain.com/ews/Exchange.asmx"
            Const  domain As String = ""
            Const  username As String = "username"
            Const  password As String = "password"
            Dim credential As New NetworkCredential(username, password, domain)
            Dim client As IEWSClient = EWSClient.GetEWSClient(mailboxUri, credential)
            Return client
End Function
Public Shared Sub TestMailReFw()
            Using client As IEWSClient = GetAsposeEWSClient2()
                        Try
                                    Dim message As New MailMessage("user@domain.com", "user@domain.com", "TestMailRefw - " & Guid.NewGuid().ToString(), "TestMailRefw Implement ability to create RE and FW messages from source MSG file")
                                    client.Send(message)
                                    ' Wait for a while
                                    Dim messageInfoCol As ExchangeMessageInfoCollection = client.ListMessages(client.MailboxInfo.InboxUri)
                                    If messageInfoCol.Count = 1 Then
                                                Console.WriteLine("1 message in Inbox")
                                    Else
                                                Console.WriteLine("Error! No message in Inbox")
                                    End If
                                    Dim message1 As New MailMessage("user@domain.com", "user@domain.com", "TestMailRefw - " & Guid.NewGuid().ToString(), "TestMailRefw Implement ability to create RE and FW messages from source MSG file")
                                    client.Send(message1)
                                    ' Wait for a while
                                    messageInfoCol = client.ListMessages(client.MailboxInfo.InboxUri)
                                    If messageInfoCol.Count = 2 Then
                                                Console.WriteLine("2 messages in Inbox")
                                    Else
                                                Console.WriteLine("Error! No new message in Inbox")
                                    End If

                                    Dim message2 As New MailMessage("user@domain.com", "user@domain.com", "TestMailRefw - " & Guid.NewGuid().ToString(), "TestMailRefw Implement ability to create RE and FW messages from source MSG file")
                                    message2.Attachments.Add(Attachment.CreateAttachmentFromString("Test attachment 1", "Attachment Name 1"))
                                    message2.Attachments.Add(Attachment.CreateAttachmentFromString("Test attachment 2", "Attachment Name 2"))
                                    client.Reply(message2, messageInfoCol(0))
                                    client.ReplyAll(message2, messageInfoCol(0))
                                    client.Forward(message2, messageInfoCol(0))
                        Catch ex As Exception
                                    Console.WriteLine("Error in program")
                        End Try
            End Using
End Sub
Overview: Aspose.Email for .NET
Aspose.Email for .NET is a set of components allowing developers to easily implement email functionality within their ASP.NET web applications, web services & Windows applications. It Supports Outlook PST, EML, MSG & MHT formats. It allows developers to work with SMTP, POP3, FTP & MS Exchange servers. It supports mail merge, iCalendar, customized header & body, header information, embedded files, Twitter & many more. It makes it easy to work with HTML or plain text emails & their attachments.

Tuesday, May 6, 2014

Create & Save an Appointment in Draft Mode inside Java Applications

This technical tip shows how Java developers can create and save an appointment in draft mode inside their own applications using Aspose.Email for Java. It can be useful to create an appointment request in draft mode, so that the basic information is added and then the same draft appointment can be forwarded to other users who might make changes. Aspose.Email for Java provides the flexibility to create and save an appointment in draft mode for later use. In order to save an appointment in draft mode, the Method property of the Appointment class should be set to Publish. The following code sample demonstrates the use of this property as an example.
Create a Draft Appointment Request
[Java]
String sender = "test@gmail.com";
String recipient = "test@email.com";

MailMessage message = new MailMessage(sender, recipient, "", "");
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar.set(2012, Calendar.NOVEMBER, 1, 0, 0, 0);
Date startDate = calendar.getTime();
calendar.set(2012, Calendar.DECEMBER, 1);
Date endDate = calendar.getTime();

MailAddressCollection attendees = new MailAddressCollection();
attendees.add(new MailAddress("attendee_address@aspose.com", "Attendee"));
WeeklyRecurrencePattern expected = new WeeklyRecurrencePattern(3);

Appointment app = new Appointment("Appointment Location", "Appointment Summary", "Appointment Description",
        startDate, endDate,
        new MailAddress("organizer_address@aspose.com", "Organizer"), attendees, expected);

//Set the Appointment as Draft
app.setMethod(AppointmentMethodType.Publish);//.Method = AppointmentMethodType.Publish;
message.addAlternateView(app.requestApointment());
MapiMessage msg = MapiMessage.fromMailMessage(message);

// Save the appointment as draft.
msg.save("Draft.msg");

Draft Appointment Creation from Text
[Java]
String ical = "BEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//Aspose Ltd//iCalender Builder (v3.0)//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nATTENDEE;CN=test@gmail.com:mailto:test@gmail.com\r\nDTSTART:20130220T171439\r\nDTEND:20130220T174439\r\nDTSTAMP:20130220T161439Z\r\nEND:VEVENT\r\nEND:VCALENDAR";
String sender = "test@gmail.com";
String recipient = "test@email.com";

MailMessage message = new MailMessage(sender, recipient, "", "");
AlternateView av = AlternateView.createAlternateViewFromString(ical, new ContentType("text/calendar"));
message.getAlternateViews().add(av);
MapiMessage msg = MapiMessage.fromMailMessage(message);
// Save the appointment as draft.
msg.save("DraftAppointment.msg");

Overview: Aspose.Email for Java

Aspose.Email for Java is a Non-Graphical Java component that enables Java applications to read and write MS Outlook MSG files from within a Java application without using MS Outlook. It enables developers to create new MSG file from scratch, update an existing MSG file, read Outlook MSG file & get its properties like subject, body, recipients in to, cc and bcc, adding or removing attachment, sender information & MAPI properties.  Aspose.Email can be used with Web as well as Desktop Application.

Sunday, April 27, 2014

Set Reminder information to MapiTask & Adding Files to PST in Java Apps

What’s new in this release?

We are pleased to announce the new release of Aspose.Email for Java 4.0.0. This release not only fix the issues that our customers reported for the previous version, but also include a number of enhancements as well. Aspose.Email for Java already supported creating, saving and updating an Outlook Task. Microsoft Outlook allows adding reminder information to the created task which then triggers at the specified time and reminds the user for the activity. This month’s release of Aspose.Email for Java further enhances the MapiTask properties by providing support for adding reminder information to the created task. This includes setting reminder time for the task, specifying the audible file name that is played as reminder and reading reminder information from a MapiTask.  Aspose.Email provides vast variety of operations when it comes to work with Personal Storage (PST) files. Talking about the list of items that can be added to a PST file, it already supports adding messages, tasks, journal and notes to the PST file. This month’s release introduces a new feature of adding files to a PST folder in addition to the above mentioned Outlook items. Similar to Outlook, our API now allows to adding files to a PST and that too without installing Microsoft Outlook. In addition to the enhancements, this month’s release also includes a number of bug fixes related to message encoding, message attachments, message conversions to other formats and PST. The main improved features & bug fixes added in this release are listed below
  • Add any files (not only messages) to PST same like Microsoft Outlook.
  • Implement search of messages or folders in the PST file on certain criteria
  • Possibility to produce MHT files that use the 7-bit encoding format
  • Adding Reminder information to MapiTask
  • On Behalf of now displayed in conversion to mhtml
  • EML to XPS, Time displayed in GMT
  • PR_BODY garbled when EML converted to MSG
  • PR_BODY lost is fixed when MSG converted from EML is dragged to Outlook
  • Embedded Attachment Name is now retrieved using ImapClient
  • Issue is resolved with TNEF format
  • Incorrect conversion is fixed from EML to MSG.
  • Attachment Name now read by latest version of Aspose.Email API
  • EML to MSG: Saved MSG can now be opened in Outlook
  • HTML body lost is fixed during EML to MSG conversion
  • EML to MHTML: Attachment name absent is resolved in output
  • Setting Html body in Outlook mapi message now working with latest version
  • EML to PST: Messages are now visible in Outlook
  • Adding files to PST
Other most recent bug fixes are also included in this release.

Overview:Aspose.Email for Java 

Aspose.Email for Java is a Non-Graphical Java component that enables Java applications to read and write Microsoft Outlook documents without utilizing Microsoft Outlook. It enables developers to create new MSG file from scratch, update an existing MSG file, read Outlook MSG file & get it's properties like subject, body, recipients in to, cc and bcc, Adding or removing attachment, sender information and MAPI properties.  Aspose.Email for Java can be used with Web as well asDesktop Application.

Tuesday, April 15, 2014

Change Color Space of PDF Document & Export PDF Bookmarks to XML File

Aspose.Email lets developers manage attachments with email messages using the MailMessage and MapiMessage class. Microsoft Outlook allows you to add as well as retrieve attachments from calendar items, that is ICS. This article shows how the same can be achieved using Aspose.Email for Java for ICS files. Aspose.Email provides an attachments collection that can be used to add and retrieve attachments associated with calendar items. This article shows how to:
  • Create and add attachments to an Appointment class object.
  • Retrieve attachments information an appointment.
  • Extract attachments from an appointment.
Sample Code for Adding and Retrieving Attachments from Calendar Items
[Java]
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar.set(2012, Calendar.NOVEMBER, 1, 0, 0, 0);
Date startDate = calendar.getTime();
calendar.set(2012, Calendar.DECEMBER, 1);
Date endDate = calendar.getTime();

MailAddressCollection attendees = new MailAddressCollection();
attendees.add(new MailAddress("attendee_address@domain.com", "Attendee"));
WeeklyRecurrencePattern expected = new WeeklyRecurrencePattern(3);

Appointment app = new Appointment("Appointment Location", "Appointment Summary", "Appointment Description",
                                                                                                            startDate, endDate,
                                                                                                            new MailAddress("organizer_address@domain.com", "Organizer"), attendees, expected);

//Attach a file from disc to this appointment
File file = new File("OutputXLS.xls");
FileInputStream fis = new FileInputStream(file);

Attachment att = new Attachment(fis, file.getName());
app.getAttachments().add(att);
fis.close();
String savedFile = "appWithAttachments.ics";
app.save(savedFile, AppointmentSaveFormat.Ics);

Appointment app2 = Appointment.load(savedFile);
System.out.println("Total Attachments: "  + app2.getAttachments().size());
for (int i=0; i< app2.getAttachments().size();i++)
{
            att = app2.getAttachments().get(i);
            System.out.println(att.getName());

        //Save the attachment to disc
        att.save(att.getName());
}

Overview: Aspose.Email for Java

Aspose.Email for Java is a Non-Graphical Java component that enables Java applications to read and write MS Outlook MSG files from within a Java application without using MS Outlook. It enables developers to create new MSG file from scratch, update an existing MSG file, read Outlook MSG file & get its properties like subject, body, recipients in to, cc and bcc, adding or removing attachment, sender information & MAPI properties.  Aspose.Email can be used with Web as well as Desktop Application.