Tr0jan
12-31-2004, 04:46 AM
Big new years smile to the C# Experts...
Ive wrote a small program in VB6 which strips attachments from a journal entry and save the attachment, this is then replaced by a hyperlink to the saved attachment.
I need to convert this into c# code, ive tried converters and that doesnt work well.
Ive come as far as reading the amount of attachments in journals, but cant seem to find any way of saving them, I can add, and remove.
If anybody can help me, this is the basic code I have for seeing the attachments:
static void Main(string[] args)
{
// Create an Outlook Application object.
Application outLookApp = new Application();
// Print all tasks.
NameSpace outlookNS = outLookApp.GetNamespace("MAPI");
MAPIFolder theTasks =
outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderJournal);
foreach(JournalItem task in theTasks.Items)
{
Console.WriteLine("-> Time Created: {0}", task.CreationTime);
Console.WriteLine("-> Subject: {0}", task.Subject);
Console.WriteLine("-> Body: {0}", task.Body);
Console.WriteLine("-> Attachments: {0}",task.Attachments.Count);
if (task.Attachments.Count > 0 )
{
Console.WriteLine ("This message has attachments");
}
}
}
Any help on saving these buggers will be appreciated.
Ive wrote a small program in VB6 which strips attachments from a journal entry and save the attachment, this is then replaced by a hyperlink to the saved attachment.
I need to convert this into c# code, ive tried converters and that doesnt work well.
Ive come as far as reading the amount of attachments in journals, but cant seem to find any way of saving them, I can add, and remove.
If anybody can help me, this is the basic code I have for seeing the attachments:
static void Main(string[] args)
{
// Create an Outlook Application object.
Application outLookApp = new Application();
// Print all tasks.
NameSpace outlookNS = outLookApp.GetNamespace("MAPI");
MAPIFolder theTasks =
outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderJournal);
foreach(JournalItem task in theTasks.Items)
{
Console.WriteLine("-> Time Created: {0}", task.CreationTime);
Console.WriteLine("-> Subject: {0}", task.Subject);
Console.WriteLine("-> Body: {0}", task.Body);
Console.WriteLine("-> Attachments: {0}",task.Attachments.Count);
if (task.Attachments.Count > 0 )
{
Console.WriteLine ("This message has attachments");
}
}
}
Any help on saving these buggers will be appreciated.