Solved

SEND AN APPOINTMENT TO OUTLOOK USING VB

Posted on 2004-04-15
12
4,263 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

23 Experts available now in Live!

Get 1:1 Help Now