Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making an appointment in shared outlook calander

Status
Not open for further replies.

ErnstJan

Programmer
Nov 10, 2002
114
NL
HELP ME PLEASE!!!!!!!!!!!!

Oke here we go again.
I want to make a program that can make appointments in a shared calander in outlook.
I have the right to make an appoinment is someone calander. I have tried it manuely.
So that part works.
I can make an appointment in my one calander, so i now that i am using the right command.
Here is the code i have so far.

Dim AppOutlook As Outlook.Application
Dim OutNamespace As Outlook.NameSpace
Dim MyItem As Object

Set AppOutlook = New Outlook.Application
Set OutNamespace = AppOutlook.GetNamespace("MAPI")
Set MyRecipient = OutNamespace.CreateRecipient("Hans van Assen")
'name of owner of the shared calander
MyRecipient.Resolve
Set HVA = OutNamespace.GetSharedDefaultFolder(MyRecipient, olFolderCalendar)
hva.display
'this command is only for checking

Set MyItem = ???.CreateItem(olAppointmentItem)

MyItem.MeetingStatus = olMeeting
MyItem.Subject = "Test"
MyItem.Location = "somewhere"
MyItem.Start = #4/5/2003 2:00:00 PM#
MyItem.Duration = 120
MyItem.Save


When the command "HVA.display" is run. I get the shared calander, so i now i am in the right spot.
At the ??? i am missing something.
When you put "appoutlook" in place of then ??? then the appointment will be made in your own calander and not in the shared you.

Hope that some nows what i am missing.

If you don't understand what i am asking please let me now.

Again PLEASE HELP ME!!!!!!!!!!!!!!!

Greetings
Ernst Jan
 
Ernst Jan,
You don't really need to do the stuff about hva.Display.

AppOutlook (your instantiated Outlook application object) is what goes where the ???'s are.

I think you're pretty close, but instead of associating the recipient (Hans...) with your appointment, you just added him as a new recipient. Try doing this:

Dim recip as Recipient

Then after MyItem.Duration, add Hans to the recipient collection of your appointment object:

Set recip = MyItem.Recipients.Add("Hans...")
recip.Type = olRequired

Then send the appointment:

MyItem.Send

This should get you pretty close.

Tranman
 
Tranman,

Thank you for responding to my question.

I now that HVA.display was not needed it was only for checking.

Your suggestion works but its not what i want.

What i want is that i can make an appointment for "hans" without having "hans" to approve.
I don't want his appointment in my own calander.

I hope you understand what i want.

Hope you have another idea for me.

Greetings,
Ernst jan
 
At last i found out how to get it work. Why it works i don't now.
Here is how I did it

Dim AppOutlook As Outlook.Application
Dim Namespace As Object
Dim MyItem As Object

Set AppOutlook = New Outlook.Application
Set Namespace = AppOutlook.GetNamespace("MAPI")
Set MyRecipient = Namespace.CreateRecipient("Hans van Assen")
MyRecipient.Resolve

Set HisCalendar = Namespace.GetSharedDefaultFolder(MyRecipient, olFolderCalendar)
Set MyItem = AppOutlook.CreateItem(olAppointmentItem)

MyItem.MeetingStatus = olMeeting
MyItem.Subject = "Test EJR"
MyItem.Location = "Ergens"
MyItem.Start = #9/24/2003 1:00:00 PM#
MyItem.Duration = 120
MyItem.Move HisCalendar


This works only for shared calendar. For your own calendar you have to use
myitem.save
instead of
myitem.move HisCalendar

Hope this helps someone with the same problem

The code is not perfect but it works. When I have the final code I will post it.
When someone has a better code. please let me now.

Greetings
Ernst Jan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top