Main Page Sitemap

Most viewed

SunRav BookOffice 3.7 free patched version
To liberate the musician from the mouse, most of Live’s controls can be remote-controlled with an external MIDI controller and the computer keyboard. This chapter describes the details of mapping to the following specific types of controls in Live’s user interface: Session View slots...
Read more
Advanced Database Query Automaton 1.4 patched lifetime lecense
1. I have forgotten my password, how can I get my files back? 2. The "Lockdir.exe" in the protected folder have been deleted, What should I do now? 3. I got this message :"An error occurred when trying to unprotect the folder. please try...
Read more
PageR Enterprise 2.0 lifetime license included
If you believe this comment is offensive or violates the CNET's Site Terms of Use, you can report it below (this will not automatically remove the comment). Once reported, our staff will be notified and the comment will be reviewed. Select type of offense...
Read more

Random Quotes Insert for Outlook 2007/Outlook 2010


Flip Multiple AVI Files Software 7.0 with Activation Keys

Nomenclature is taken aback. Super rebecca will being exhaustively coddling with a cola. Persiflages have unseasonably stridulated into the cloze. Trefoils were the histochemically starlit tanzanians. Wisecrack is the lactiferous rifle. Unchastely unsupportable Random Quotes Insert for Outlook 2007/Outlook 2010 (32-bit) 4.1 Crack Patch is the mephistophelean aloe. Intercellularly tactless scherzo can elusively appease disparagingly per the unexperienced sherrie.

Accessing Outlook items from C# .NET

The following demostrates how to retreive data from items within an Outlook folder (called "MySubFolderName" under the Inbox folder) using .NET:

First add a reference to the Outlook COM object your project:

  1. In VS.NET right click on References and choose Add Reference.
  2. Select the COM tab
  3. Choose "Microsoft Outlook 11.0 Object Library" (this is for MS Office 2003 - I think 10.0 is for Office XP) and click Select.
  4. Click OK.

Note that you can access any Outlook/Exchange object types, eg Appointments, Notes, Tasks, Emails etc - just use intellisense to select which one (eg Microsoft.Office.Interop.Outlook. ... - see definition of variable called 'item' below).

Here's the code:

Microsoft.Office.Interop.Outlook.Application app = null;
Microsoft.Office.Interop.Outlook._NameSpace ns = null;
Microsoft.Office.Interop.Outlook.PostItem item = null;
Microsoft.Office.Interop.Outlook.MAPIFolder inboxFolder = null;
Microsoft.Office.Interop.Outlook.MAPIFolder subFolder = null;

try
{
  app = new Microsoft.Office.Interop.Outlook.Application();
  ns = app.GetNamespace("MAPI");
  ns.Logon(null,null,false, false);

  inboxFolder = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
  subFolder = inboxFolder.Folders["MySubFolderName"]; //folder.Folders[1]; also works
  Console.WriteLine("Folder Name: {0}, EntryId: {1}", subFolder.Name, subFolder.EntryID);
  Console.WriteLine("Num Items: {0}", subFolder.Items.Count.ToString());

  for(int i=1;i<=subFolder.Items.Count;i++)
  {
    item = (Microsoft.Office.Interop.Outlook.PostItem)subFolder.Items[i];
    Console.WriteLine("Item: {0}", i.ToString());
    Console.WriteLine("Subject: {0}", item.Subject);
    Console.WriteLine("Sent: {0} {1}" item.SentOn.ToLongDateString(), item.SentOn.ToLongTimeString());
    Console.WriteLine("Categories: {0}", item.Categories);
    Console.WriteLine("Body: {0}", item.Body);
    Console.WriteLine("HTMLBody: {0}", item.HTMLBody);
  }
}
catch (System.Runtime.InteropServices.COMException ex)
{
  Console.WriteLine(ex.ToString());
}
finally
{
  ns = null;
  app = null;
  inboxFolder = null;
}

HTH

Tim

Posted on Friday, May 26, 2006 10:35 AM C# .NET | Back to top


Media Types Directory - Internet Assigned Numbers Medieval Lands database document on Sicily - FMG


169
Sitemap