Solved

SEND AN APPOINTMENT TO OUTLOOK USING VB

Posted on 2004-04-15
12
4,264 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
ID: 10834267
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
ID: 10835892
buggar!

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

Author Comment

by:kinton
ID: 10840355
I should think so.  Is this a large install?  Where can I find it?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 10

Accepted Solution

by:
Kavar earned 500 total points
ID: 10841388
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
 
LVL 2

Author Comment

by:kinton
ID: 11040996
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
ID: 11041066
Without Sounding rude, I think I have helped some...
0
 
LVL 2

Author Comment

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

Author Comment

by:kinton
ID: 12602161
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
ID: 12602270
Slight ammendment:

It is ObjSess that hasn't been set.

Is this set in the same way as MAPI?
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …

813 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

19 Experts available now in Live!

Get 1:1 Help Now