• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Question: Basic Email and Outlook Calendar

Segnosaur

Penultimate Amazing
Joined
Jan 18, 2002
Messages
21,807
Location
Canada, eh?
I've recently been asked to look into an old legacy system we have that was written in Visual Basic 6.0. This system uses an external component called Jmail to send out emails.
One of the things I've been asked to do is to see if I can set up the system to create calendar events in Microsoft Outlook.

I'm assuming this can't be done the way we're handling emails right now. (Jmail seems to be a pretty basic smtp component.) But, my boss seems to be convinced that there's a way. I've searched the product documentation (and elsewhere on the web) and haven't found a way.

So, is there a way to send meeting requests or set up calendar events through basic email (through something like J-mail)? Or might we have to rewrite things to use something like MAPI?
 
Even if you could find a way to send it from basic mail (iirc, it's just an ics file, yes?) it would probably be such a dirty hack as to cause nothing but headaches. I'd suggest using MAPI.
 
I must be missing something. What does the calendaring function have to do with MAPI?
 
I must be missing something. What does the calendaring function have to do with MAPI?

I was assuming this was how to generate the ics file and may be mistaken in what is being proposed here.

If he's just scripting the generation of an email, I would assume if there is a plug in to use via something supported and already existing it would be better than to code something from scratch that may not fit well.

What I was assuming here is the difference between me creating a bash script to mailx an embedded ics file in an email so outlook can see it, and having a precompiled and supported option to generate that via a different means. While I could script it, I have nothing but headaches making sure I do it in a way Outlook likes.

am I not looking at this right? (Please take into account I'm not a windows person, but I assumed using MAPI could have a plug in for ics file generation via excahnge, etc.)


ETA:

I'm pretty sure you could script this via OpenMAPI or the EvolutionMAPI plug in...but I'd have to give it a try to be sure. I assumed you could do this via an MS product/exchange etc.
 
Last edited:
You can write either a C# or VB program to do what you need. Check www.outlookcode.com for examples. The last time I went to that site was two years ago.

Basically, you create an outlook object (application) and use the methods and properties provided by that object. Take note that if you are to access the contact addresses, you might need to use redemption (another object that sits between your program and outlook) to avoid the security prompt.

Joseph
 
I'm not a programmer but I did some stuff ages ago in VBA for my previous employer which might be of use.

Function fnc_calendar_add(Optional dateStart As Date, Optional dateEnd As Date, _
Optional strSubject As String = "", Optional strBody As String = "", Optional lngID As Long)
'Add appointment to Calendar
'April 2001
Dim OutObj As Object
Dim OutAppt As Object
Dim CalendarObj As Object
On Error GoTo err_here:

Set OutObj = CreateObject("outlook.application")
Set CalendarObj = OutObj.GetNamespace("MAPI").Folders("Personal Folders").Folders("Calendar")
Set OutAppt = CalendarObj.Items.Add

With OutAppt
.BillingInformation = "Use this as a marker"
.AllDayEvent = True
.start = Format(dateStart, "dd/mm/yy")
.end = Format(dateEnd, "dd/mm/yy")
.subject = strSubject
.Body = strBody
.mileage = lngID
.ReminderSet = False
.Categories = "Your category here"
.Save
End With
Exit_here:
Set OutAppt = Nothing
Set CalendarObj = Nothing
Set OutObj = Nothing
Exit Function

err_here:
Call fnc_error(err, err.Description, "Adding Outlook item")
Resume Exit_here:
End Function

As Joseph says, there may be security stuff to take into account.
 
I was assuming this was how to generate the ics file and may be mistaken in what is being proposed here.

If he's just scripting the generation of an email, I would assume if there is a plug in to use via something supported and already existing it would be better than to code something from scratch that may not fit well.

Well, if the mail system is using something like Exchange, then as others have mentioned I'd look into using the Outlook Object Model (the COM API wowbagger mentions), and using this and this as a guide for the object model itself. Now, if the Exchange being used is 2007, there might even be a more elegant way through taking advantage of PowerShell, which would be closer to your Bash example earlier and may even require fewer lines of code to achieve the goal. That's getting over my head, though, since I'm still way wet behind the ears with the C# and scripting with it.

am I not looking at this right? (Please take into account I'm not a windows person, but I assumed using MAPI could have a plug in for ics file generation via excahnge, etc.)

You're looking at it more right for the newer versions of Exchange, but the older Exchange isn't quite as versatile as far as using shell-level scripting to achieve the goal. Then again, while I may be a Windows guy I often approach problems from a pseudo-*nix point of view, so my suggestions aren't always going to fall into 'proper' context for Windows programming problem-solving (which is another reason I don't program). I call what I do sometimes "the Han Solo Method" (stick in a possible fix, punch the panel if it doesn't work, and if it doesn't work hack it so it does). Not a good approach if you're building a solution (but quite useful in fixing problems in old and otherwise-crumbling infrastructure).
 
I was assuming this was how to generate the ics file and may be mistaken in what is being proposed here.
Yeah, I guess I might have been a little unclear here.

Right now, we have a system that sends out simple reminders to our client about upcoming meetings. Something along the lines of "Reminder: business lunch on Tuesday". Right now, this system uses the jmail package, and it sends out very basic reminders.

What my boss WANTS to do is for our users that are using outlook, instead of sending just a simple text reminder, to send an actual meeting request (one where the user has to accept or decline). Or, something that might insert an entry into the user's calendar

I've developed mail-based apps before, but I've never had to genate meeting requests or calendar entries. (So far, its all been straight forward SMTP stuff.)

My boss is convinced that there's some sort of 'back door' way to make exchange think a regular SMTP email is a meeting request, some code that can be added to the header or body. I think he might be barking up the wrong tree, but I still have to check it out.
 

Back
Top Bottom