You’ve got to applaud interactive advertising

If you go to MySpace you are almost guaranteed to see an ad that is a game. There one’s like “Bush vs. Schwartzeneger” and “Shoot 20 Ducks”. These are really great ideas. They get somebody interested in the game and lets their competitive nature take over. Somebody will be more willing to get their “Free Ringtone” or “Dinner at Chili’s” if they feel they have earned it.

I’m curious if this interactive advertising has a proper name and exactly what kind of converstion ratio they have.

Google Outlook Synch

So, I have this developed. It isn’t my best work but it works. It really needs to handle when Google Calendar can’t be reached. However the biggest issue is the install. The default installer that is built with Studio 2005 doesn’t work completely. I would provide instructions on how to install manually but I really don’t know. Studio does it all for you nicely while you are developing. Also I wanted to include the VSTO runtime right into the install but I can’t find a VSTO merge module.

MySpace Friend Whores

Everybody who’s spent time on MySpace has fought a slight addiction. This is commonly known. The other addiction though is people who willing become “Friend Whores”. TOM IS NOT YOUR FRIEND! Tom doesn’t know you and Tom doesn’t want to know you, move along. The first thing you can do on your road to recovering from being a “Friend Whore” is to remove Tom from your friend list. You can do it.

Secondly, remove all people you don’t actually know. There’s only one person on my list I don’t know. She is a butt. It’s a cute butt and for some reason she accepted my invitation (probably because she is a friend whore). If she ever changes her picture to a different body part I might have to MySpace Break-up with her.

Do yourself a favor and clean out your friend list and stop being such a whore about it! :)

Google-Outlook Calendar Goal 3 Revisited

If you’ve been reading my other posts then you’ll know that I’ve been taking a few moments throughout the day, when I need a few minute break, to look at what it will take to programmatically add my Outlook appointments to my Google Calendar. This way I can still accept appointments in work PLUS I can use my Google Calendar AND get messages on my cell when an appointment is due (This is a free feature of Google Calendar but not Outlook).

Here’s Goal 1, Goal 2 and Goal 3 for reference.

I had to revisit Goal 3 however. The problem is that I envision this Outlook add-in being most useful in a corporate setting. Nearly all corps have a proxy server. This is something that I didn’t plan for. However I have a solution. This solution is written using C# and .Net 2.0. This soultion can also be useful for any application where you need to go through a proxy server that requires credentials.

Set the following before your webservice or application requests a web resource.

System.Net.NetworkCredential ocredentials = new System.Net.NetworkCredential(“ProxyUser”, “ProxyUserPassword”);

IWebProxy proxyObject = new WebProxy(“http://ProxyAddress:ProxyPort”, true);

proxyObject.Credentials = ocredentials;

HttpWebRequest.DefaultWebProxy = proxyObject;

Outlook-Google Calendars Goal 3

Goal 3: Enumerate Google Appointment Lists (List Google Calendar Entries)
WARNING: I am using Visual Studio 2005 and C# (You’ve been warned)

For this goal I first did some looking on Google’s site. You can get the Google Calendar API Overview Here. It didn’t take long to discover that what I wanted was a Calendar Feed.

If you read some of the information out there, you may think that you need Google Calendar MagicCookie. You don’t. Actually I found that the appointment start and end times didn’t come over when I used this Magic Cookie link. To access your calendar feed in CSharp, all that you need is your username and password. Well, you also need the 3 GData DLLs supplied by Google.

These 3 DLLs can be downloaded with the Google Calendar Libraries here. These files are GData.dll, GCalendar.dll and GExtensions.dll. You add references to them in your C# project and then add the following using statements.

using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Calendar;

In my example I have simple Windows application written in C#. The form prompts for Username, password and a URL (or URI if you want to be exact).

The username is the part of your email address that appears before your gmail address. The password is your normal gmail password. The URL is
http://www.google.com/calendar/feeds/user@gmail.com/private/full
. Note the “user@gmail.com” part. This needs to be replaced with your GMail email address. In my example I change the url automatically.

//Create new query and service objects. These are all from gData.dll (Google.GData.Client) and gCalendar (Google.GData.Calendar).

FeedQuery Q = new FeedQuery();
CalendarService CS = new CalendarService(“CalendarTest”);

//Set the credentials.
CS.setUserCredentials(textBoxUsername.Text, textBoxPassword.Text);
GDataGAuthRequestFactory F = (GDataGAuthRequestFactory)CS.RequestFactory;

Q.Uri = new Uri(textBoxUrl.Text);

//Event Feed is in gextensions.dll (Google.GData.Extensions)
EventFeed EF = CS.Query(Q);
foreach (EventEntry EE in EF.Entries)
{
DateTime
Start = DateTime.Parse(“1/1/2000 00:00″),
End = DateTime.Parse(“1/1/2000 00:00″);

//We only take the first time, even if there is more. We may need to handle multiple
// ones in the future.
if (EE.Times.Count > 0)
{
Start = EE.Times[0].StartTime;
End = EE.Times[0].EndTime;
}

MessageBox.Show(EE.Title.Text + “\n” +
EE.Content.Content + “\n” +
Start.ToString(“MM/dd/yyyy HH:mm”) + “\n” +
End.ToString(“MM/dd/yyyy HH:mm”));
}

Here’s the basic parts of the sourcecode. You can also download the full Google Calendar Enumeration Program Here.

Get Google Calendar’s Magic Cookie

Although it doesn’t appear that you need a MagicCookie in order to fetch the information
that I am looking for in my
Outlook-Google Synch
program, I began detailing how to get the MagicCookie
feed. You can use this feed to pull information from your Google Calendar.

1. Log into Google Calendar.

2. On the left hand side select the calendar that you want, there should be down
arrow next to the target calendar. Click that and select “Calendar settings”.

Google Calendar Magic Cookie 1

3. At the bottom of the screen you should see section labled “Private Address:”.
There should also be an “XML” link by it. Click on this XML link and save
the address.

Google Calendar Magic Cookie 2

That’s it. If you ever think your link/feed has been compromised just “Reset Private URLs” on the last screen shown and you’ll get a new one.

Keep an eye on this blog to find out how to synch your Outlook and Google calendars.

Geiger-OFF 2006 (Revisited)

Ok, I’ve mentioned Teddy Geiger before. For some reason he continues to fail to mention me. He must be too afraid.

The main purpose of this post is to point out one more thing. I’m a native of Buffalo, while young Teddy is from Rochester (about 1 hour from Buffalo). Everybody in Western New York knows that Rochester is Buffalo’s little wannabe brother. This is the same between me and the Other Geiger.

He hate me cuz he ain’t me.

Now I’m off to mill about such things as work on my real job and look at my Outlook-Gmail Calender

Calendar Goal 2

Well it seems like Goal 2 was the easiest one. All that I had to do was add a timer to “ThisApplication” class and assign the properties. I wasn’t sure if there was going to be a catch that prevented me from using a timer. Here’s the gist of the code that I used as a test.

public partial class ThisApplication
{
private Timer SynchTimer;

private void ThisApplication_Startup(object sender, System.EventArgs e)
{
SynchTimer = new Timer();
SynchTimer.Interval = 10000;//A ten second test interval.
SynchTimer.Tick += SynchTimer_Tick;
SynchTimer.Enabled = true;
string
RestrictString = “[Start]

Also here is Calendar Goal 1 in case you missed what I am trying to do here.

Google Outlook Calendar Synchronizer

I mentioned synching my Outlook and Google Calendars. Instead of waiting for somebody to do it for me I’m going to start doing it myself. I’m not sure I’ll finish but hopefully I can save somebody time in the future and provide a Visual Studio/Outlook tutorial on the way. I plan on publishing all source code as I go to make it easier for download.

Main Goal: Synch Outlook and Google Calendars

  • Goal 1: Enumerate Outlook Appointments
  • Goal 2: Schedule Enumeration
  • Goal 3: Enumerate Google Appointments
  • Goal 4: Compare Appointment Lists in a unified format.
  • Goal 5: Add and delete (Synchronize) appointments based on user settings.

To be able to access the Microsoft Office (2003) System through Visual Studio 2005 I needed VSTO, this is Visual Studio Tools for the Microsoft Office System or Visual Studio Tools for Office.

There are different VSTO packages and versions. I will not go into them. I do not because the whole thing confuses me.

Step 1: Install VSTO. Fortunately I had this CD through an MS partner program. However it will cost a few hundred dollars if you do not. You must have Office 2003 installed along with Office 2003 Service Pack 1. After installing the service pack, VSTO installed with no hitch although it was a pretty sluggish install.

Step 2: Learning the interface. Seeing as how Outlook will need to be open in order to enumerate the appointments, I have chosen to make an Outlook add-in. Fortunately I was able to find a few VSTO-Outlook Samples on Microsoft.com.

After installing VSTO, it is very easy to create a blank Outlook AddIn. Create a new project, choose either VB or C# (I use C#) and expand the list. Select “Office” and the “Outlook Add-in” Visual Studio installed templates as seen here.
VSTO Outlook Add-in

After clicking ok to create the blank project, I took a look at the Solution Explorer. Right now there is only one file that I am interested in. The main guts of code go into “ThisApplication.cs”.

Opening ThisApplication.cs showes to methods already created. These are “ThisApplication_Startup” and “ThisApplication_Shutdown”. You’ve probably guessed that the first one is fired at startup and the second and shutdown.

For my first test I thought I would just show myself how many appointments I currently have in Outlook. Before I go into that the first thing that you should keep in mind is that Outlook is all about MAPI folders. MAPI (Messing API or Messaging Application Programming Interface) basically is the interface dealing with messages and message stores. It kind of should be called MS MAPI as I believe that Microsoft owns the interface/protocol. You can read more about MAPI here and here.

The reason that I point out MAPI folders is that it is a generic folder. Your inbox is a MAPI folder, so is your outbox, calendar, contacts etc… All MAPI folders are of the type “Outlook.MAPIFolder”. This struck me as odd and I struggled with accepting this. Initially I thought that each folder should be a different type. I thought the Inbox and Outbox should be of an email type because it contained emails while the calendar would be yet another type. However this is more similar to a directory structure than a class so it should make more sense as we go along.

So on to my first Outlook Add-in. All that I did was place the following 3 lines in the Startup method and ran the program. VS is smart enough to add and run the add-in. All that you need to be sure of is that Outlook isn’t currently open.

Outlook.MAPIFolder Calendar = this.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.Items Appointments = Calendar.Items;
MessageBox.Show(Appointments.Count.ToString());

Upon running Outlook you should see a popup message with a number in it telling you how many appointments are in your Calendar. It is kind of useless except to show you that it works. However we are close to actually detailing the appointments at this point.

The next step is to iterate through the items and put them into a class that will make it easier for us later on. I ended up saving these items into a class. This way when we load the information from our Google calendar we can do so to this class with no problems.

You can see the source code here that I have for ENUMERATE OUTLOOK APPOINTMENTS USING VSTO.

I will be working on Goal 2 when I need a break durning my normal work day.