?
Solved

SEND AN APPOINTMENT TO OUTLOOK USING VB

Posted on 2004-04-15
12
Medium Priority
?
4,270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
Kavar earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 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