Library tutorials & articles
How to access Outlook and post to a blog using C#
- Introduction
- Posting to your blog
- Accessing the web service
Introduction
This is my first attempt at an instructional article, so opinions on quality would be great! Let me know if I made any mistakes too... It's mainly for all those like Robert Scoble who would like to be able to drag and drop an item to a folder in their Outlook and post it instantly to their Blog, but it also covers web services and talking to Outlook.
Accessing Outlook
The first requirement is to be able to access Outlook. For those with Outlook/Office 2003, you should run the office install and choose .NET Programmability Support. For Office XP, you can download the Interop assemblies from here. The appropriate assemblies will then be installed in the GAC, and you can then add a reference from your Visual Studio project to Microsoft.Office.Interop.Outlook.dll.
Add an appropriate using clause:
using Outlook = Microsoft.Office.Interop.Outlook;
Then you should be able to instantiate an Outlook object and make requests of it:
Outlook.Application app = new Outlook.ApplicationClass();
Outlook.NameSpace NS = app.GetNamespace("MAPI");
Outlook.MAPIFolder inboxFld = NS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
This will give you access to inboxFld, which will allow you to iterate through the contents of the inbox! You can also change this to iterate through notes, or through calendar entries, tasks, etc. as you want.
For example, to iterate through your mail you can do:
foreach(Outlook.MailItem t in inboxFld.Items)
{
Console.WriteLine(t.Subject);
}
To write out all the subjects on the console. The only annoying thing will be you need to say yes to a security dialog when you access mail items - this is a new security "feature" of Outlook - I'm working on getting around this, it doesn't happen for tasks or notes, etc.
Once you are able to access Outlook, your next objective is to post data to your weblog. You can avoid duplicates through one of two ways:
- Keep track of what has been posted by maintaining an
ArrayListof articles on your blog and checking before trying to post one. - Keep track of what has been posted by changing something in the
MailItem's - e.g. - set or clear a flag.
The first method requires keeping a list synchronised with the blog, the second is quickest and easiest, but wouldn't be suited with multiple people possibly posting things.
Related articles
Related discussion
-
Buy cheap Xanax overnight. Cheap Xanax. Overnight delivery of Xanax in US no prescription needed. Cheapest Xanax.
by asleymar (0 replies)
-
Buy Soma online without a prescription. Soma drug no prescription. How to get Soma prescription. Soma cod accepted.
by asleymar (0 replies)
-
Cheap online order Fioricet. Cheap discount Fioricet. Offshore Fioricet online. How to buy Fioricet online without a prescription.
by asleymar (0 replies)
-
Buy Ambien no visa without prescription. Not expensive Ambien prescriptions. Ambien no rx. Cod delivery Ambien.
by asleymar (0 replies)
-
Tramadol without doctor rx. Buy Tramadol over the counter cod overnight. Cheap Tramadol cod delivery. Buy Tramadol from mexico online.
by asleymar (0 replies)
Related podcasts
-
Object-Oriented Programming in Ruby
In this episode, I talk with Scott Bellware about object-oriented programming in Ruby, and Ruby's object model. This is taken from a private conversation, and the audio quality suffers at times. Much thanks to Scott for allowing this to be released.This episode of the Alt.NET Podcast is bro...
I am working for fetching contacts from outlook express. I have explored a lot , But I couldn't .
How can I get access microsoft outlook express's conatacts?
Is this possible?
Hii Friends,
This is kumar, I facing the following problm. If Any body knows the solution please pass the solution to my E-Mail Id.
Query: How To Dynamically Pass The .aspx Page Values Into an .Html Page In ASP.NET + C#. Here I am Passing more than one value. I dont want to write hard code.
Query: I am writing the code for getting the data from database. In this data i have images. Then i have to pass these images to web page. Its like a banner Engine. But, Here i dont wont to take a "adrotator". I had taken a Html Iframe control. Then I have to pass the image name throuth src. Then i had verified and got the required images through database comparisons. When i run the application i have to display the web like "http://wepage1.aspx/sample.html". In this sample.html page is the dynamic page. When u run the web page ".aspx" that time i need to display/ pass these wepage image values to .html(sample.html) page.
How this is possible? If anybody knows the solution please pass the solution to my ID
Thnx and Regards
Naresh Kumar
ravuri_naresh@yahoo.co.in
hello,
I want somre help from u.we are using check boxes in datagrid for activating and deactivating.how to put that
check boxes in datagrid and reflect changes in database
thank you,
MohanVarma.
This thread is for discussions of How to access Outlook and post to a blog using C#.