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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding appointments to Public Calendar in Outlook 1

Status
Not open for further replies.

reisende

Programmer
Mar 16, 2004
74
0
0
US
Hi everyone,

I need to create a form on our intranet to allow PTO to be requested on-line. The crux of the issue is that I need to add an appointment to a public calendar (Public Folders/All Public Folders/IT Calendar).

By using vCalendar I've been able to add an appointment to my local calendar, but I am stuck on how to address the files properly to save to the public calendar, or if it is even possible. I'm assuming it is, but assuming does no one any good.

We are running Exchange 2000 for the mail and AD services.

Any suggestions, words of wisdom or point in the right direction will be rewarded with multiple stars and my undying gratitude :)

Thanks in adavance.
 
I have been wanting to do this for a while now myself but have found very little information on it.

I have not found any way to actively pull calendar information either. All examples I have seen for putting an Outlook calendar on the web is based on getting an extract of the calendar so you are dealing with static data.

My suggestion is to look into methods of accessing WEBDAV which is the exchange servers web interace. Everything should be accessible through webdav but you will have to research on how to get to and manipulate specific objects and collections.

If you come up with anything I would love to see it.

One test you can do is if your company has webdav setup, access a calendar through the browser in webdav. Look at the path that is used. Webdav is using XML to query the exchange server and return an XML document. If you can grab the XML that is returned you can work your way through it to get an idea of the object structure so you will know how to address specific objects.

Good luck. Let me know if you come up with anything. If I had time I would be working on it myself but....



Paranoid? ME?? WHO WANTS TO KNOW????
 
Thanks niteowl, that sounds like a good idea. I'll do some research into WEBDAV and see what we have going on there. I haven't worked with XML a whole lot, but enough to figure something out.

I'm pretty much in the same boat as you are, though. I work on so many things here that if a project looks like it will take too much of my time it usually gets modified or scrapped altogether. That doesn't help very much as far as learning new things, but I guess that's not what they pay me for :)

I'll post a reply if I'm able to continue on this and get a working version.

Thanks again.
 
This code was posted in an exchange server programming newsgroup.
Code:
Servername = "servername"

Set Person = CreateObject("CDO.Person")
set conn = createobject("ADODB.Connection")
set com = createobject("ADODB.Command")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
strNameingContext = iAdRootDSE.Get("configurationNamingContext")
strDefaultNamingContext = iAdRootDSE.Get("defaultNamingContext")
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
svcQuery = "<LDAP://" & strNameingContext & ">;(&(objectCategory=msExchExchangeServer)(cn=" & Servername & "));cn,name,legacyExchangeDN;subtree"
Com.ActiveConnection = Conn
Com.CommandText = svcQuery
Set Rs = Com.Execute
while not rs.eof
 GALQueryFilter = "(&(&(&(& (mailnickname=*)(!msExchHideFromAddressLists=TRUE)(| (&(objectCategory=person) (objectClass=user)(msExchHomeServerName=" & rs.fields("legacyExchangeDN") & ")) )))))"
 strQuery = "<LDAP://" & strDefaultNamingContext & ">;" & GALQueryFilter & ";distinguishedName,mail;subtree"
 com.Properties("Page Size") = 100
 Com.CommandText = strQuery
 Set Rs1 = Com.Execute
 while not Rs1.eof
  Person.DataSource.Open "Ldap://" & rs1.fields("distinguishedName")
  Set Mailbox = Person.GetInterface("IMailbox")
  call CreateAppointment(now(),dateadd("h",1,now()),"test appointment","Meeting Room","Important",mailbox)
  rs1.movenext
 wend
 rs.movenext
wend
rs.close
set conn = nothing
set com = nothing
wscript.echo "Done"


Function CreateAppointment(StartTime,EndTime,Subject,Location,TextBody,iMbx)
    on error resume next
    set iAppt = createobject("CDO.Appointment")
    Set Conn = createobject("ADODB.Connection")
    Conn.Provider = "ExOLEDB.DataSource"
    'Set the appointment properties
    With iAppt
        .StartTime = StartTime
        .EndTime = EndTime
        .Subject = Subject
        .Location = Location
        .TextBody = TextBody
        'Save the appointment
        Conn.Open iMbx.BaseFolder
        .DataSource.SaveToContainer iMbx.Calendar, Conn
    End With
    Set CreateAppointment = iAppt
    Wscript.echo "Appointment Created in " & iMbx.Calendar

End Function

And Microsoft has an example at this link:

Both examples use CDO to establish the connection and I have not gotten it to work here.



Paranoid? ME?? WHO WANTS TO KNOW????
 
Looks promising at least. I'll give it a try when a get some time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top