Solved

SEND AN APPOINTMENT TO OUTLOOK USING VB

Posted on 2004-04-15
12
4,262 Views
Last Modified: 2012-06-22
Hi,

Does anyone know how I can send an email from visual basic, that will appear in outlook as a calender appointement, then when the user accepts appear in their calender?

Please not I cannot rely on outlook being installed on the host machine, further I would like to specify a sender name

thanks
0
Comment
Question by:kinton
  • 5
  • 3
12 Comments
 
LVL 27

Expert Comment

by:Dabas
Comment Utility
Hi kinton:
> Please not I cannot rely on outlook being installed on the host machine

This makes an already difficult task nearly impossible

Dabas
0
 
LVL 10

Expert Comment

by:Kavar
Comment Utility
buggar!

You can do it but it will require CDO to be installed, is this acceptable?
0
 
LVL 2

Author Comment

by:kinton
Comment Utility
I should think so.  Is this a large install?  Where can I find it?
0
 
LVL 10

Accepted Solution

by:
Kavar earned 500 total points
Comment Utility
it used to be a seperate component, (outlook 98 era)  But at this point I think that if you include the CDO dependancy your install will include all of the necessary files...

Dim objSess As Session
Dim objCalFold As Folder ' calendar folder to create appointments in
Dim colAppts As Messages ' appointments collection in calendar folder
Dim objNewAppt As AppointmentItem
Dim colRecips As Recipients ' users to be invited to the meeting

Set objCalFold = objSess.GetDefaultFolder(CdoDefaultFolderCalendar)
Set colAppts = objCalFold.Messages
Set objNewAppt = colAppts.Add ' no parameters when adding appointments
With objNewAppt
   .MeetingStatus = CdoMeeting ' required before calling .Send
   .Importance = CdoHigh
   .Location = "My office"
   .Subject = "Extremely important meeting tomorrow at 9:00 AM!"
   .Text = "We will discuss stock distribution."
   .StartTime = DateAdd("d", 1, DateAdd("h", 9, Date))
   .EndTime = DateAdd("h", 1, .StartTime) ' meeting to last one hour
   Set colRecips = .Recipients ' empty collection of users to invite
End With
With colRecips ' populate collection with invitees
   .Add "John Doe", "SMTP:johndoe@microsoft.com" ' can't use parentheses!
   .Add "Joe Blow", "SMTP:joeblow@microsoft.com"
   .Resolve ' default to dialog in case of name ambiguities
End With
objNewAppt.Send ' appointment becomes a meeting at this moment
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 2

Author Comment

by:kinton
Comment Utility
Sorry, I have not had a chance to test it yet it would appear Dabas comments are correct and I intend to allocate him the points.  I should have this completed within the next couple of days.
0
 
LVL 10

Expert Comment

by:Kavar
Comment Utility
Without Sounding rude, I think I have helped some...
0
 
LVL 2

Author Comment

by:kinton
Comment Utility
Sorry, I meant Kavar - I copied and pasted the wrong name - please accept my apologies.
0
 
LVL 2

Author Comment

by:kinton
Comment Utility
This got handed over to someone else in my company and was left for a while, appologies for the delays in replying.

My colleague who has taken on the project is getting the following error on the line below:

runtime error 91
object variable or with block variable not set.

on this line:

Set objCalFold = objSess.GetDefaultFolder(CdoDefaultFolderCalendar)

Seeing as both objCalFold and objSess are defined both myself and my colleague would take a guess that the problem lies with CdoDefaultFolderCalendar, but neither of us know enough about CDO to know for sure.

I'm using Kavar's code as is, and I have referenced CDO 1.2.1

Any help would be much appreciated.
Regards,
Kinton
0
 
LVL 2

Author Comment

by:kinton
Comment Utility
Slight ammendment:

It is ObjSess that hasn't been set.

Is this set in the same way as MAPI?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now