Skip to content

Instantly share code, notes, and snippets.

View aspose-com-gists's full-sized avatar

Aspose.com Gists aspose-com-gists

View GitHub Profile
@aspose-com-gists
aspose-com-gists / uncompress-z-file.cs
Last active April 18, 2025 12:52
Uncompress Z File in C#
string dataDir = "Desktop";
//Extracts the archive and copies extracted content to file stream.
using (var archive = new ZArchive(dataDir + "archive.z"))
{
// Create a FileOutputStream to write the extracted content to the output file.
using (var extracted = File.Create(dataDir + "alice29_out.txt"))
{
// Extract the contents of the archive to the output file by calling the Extract method.
archive.Extract(extracted);
}
@aspose-com-gists
aspose-com-gists / convert-epub-to-pdf-in-python.md
Last active April 18, 2025 03:51
Convert EPUB to PDF in Python
public class main {
public static void main(String[] args) throws FileNotFoundException, java.io.IOException {
// Set the path for the working directories.
String sourceFile = "/files/sample.xar";
String outDir = "/Desktop/";
// Open a file input stream to read the .xar file located at the given path.
try (FileInputStream fis = new FileInputStream(sourceFile)) {
// Initialize an instance of the XarArchive class with the input stream.
try (XarArchive archive = new XarArchive(fis)) {
// Extract all the files in the archive to the directory provided by calling the extractToDirectory method.
@aspose-com-gists
aspose-com-gists / create-cpio-file.java
Created April 16, 2025 14:36
Create CPIO file in Java
// Create CPIO file
import com.aspose.zip.CpioArchive;
public class main {
public static void main(String[] args) {
// Define the path for the working directory.
String dataDir = "/files/data/";
String outDir = "/Desktop/";
// Initialize an object of the CpioArchive class.
try (CpioArchive archive = new CpioArchive()) {
@aspose-com-gists
aspose-com-gists / AddingReferenceAttachments.cs
Created April 15, 2025 11:31
Managing Reference Attachments in MSG Files Using C#
var options = new ReferenceAttachmentOptions(
"https://drive.google.com/file/d/1HJ-M3F2qq1oRrTZ2GZhUdErJNy2CT3DF/", // Attachment URL
"https://drive.google.com/drive/my-drive", // Provider link
"GoogleDrive" // Provider type
);
// Add reference attachment
msg.Attachments.Add("Document.pdf", options);
@aspose-com-gists
aspose-com-gists / AppendMessages.cs
Created April 15, 2025 11:21
Integrate Gmail into C# applications
using (IGmailClient client = GmailClient.GetInstance(clientId, clientSecret, refreshToken, email))
{
// Create a message to append to the "Inbox"
MailMessage message = new MailMessage("[email protected]", "[email protected]", "Subject for inbox message", "Body of the message");
// Append the message to the inbox with the "INBOX" label
string messageId = client.AppendMessage(message, "INBOX");
Console.WriteLine($"Message appended to the Inbox. ID: {messageId}");
}
@aspose-com-gists
aspose-com-gists / assigningFlagsForRecipients.java
Created April 15, 2025 11:12
Manage Outlook email follow-up flags using Aspose.Email for Java
MapiMessage msg = MapiMessage.load(fileName);
// Set the message as draft
msg.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
// Define a reminder time for recipients
Date reminderDate = new Date(2024 - 1900, 4, 23, 16, 40, 0);
// Assign the follow-up flag for recipients
FollowUpManager.setFlagForRecipients(msg, "Follow up", reminderDate);
@aspose-com-gists
aspose-com-gists / RetrieveReactionsFromMsgFile.cs
Created April 15, 2025 11:03
Retrieve Outlook reactions from MSG files in C#
// Load the message file
var msg = MapiMessage.Load(fileName);
// Retrieve the list of reactions on the message
var reactions = FollowUpManager.GetReactions(msg);
// Iterate through each reaction and output the details to the console
foreach (var reaction in reactions)
{
Console.WriteLine($"User: {reaction.Name}, Email: {reaction.Email}, Reaction: {reaction.Type}, Date: {reaction.ReactionDateTime}");