Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Thu, 1 Dec 2005 21:06:59 -0500,    group: microsoft.public.exchange2000.development        back       


Programmatically Create Calendar Items in mailbox store   
Hi Guys -
Is there a way to programmatically recurse a mailbox store and create a 
calendar entry for all the mailboxes in that store?
Is there a 3rd party software that would do this?

If it can be scripted, any samples or pointers? Thanks for your time...
date: Thu, 1 Dec 2005 21:06:59 -0500   author:   Siva

Re: Programmatically Create Calendar Items in mailbox store   
One way would be to use a combination of ADSI to work out what mailboxes are 
on the server and then use CDOEX to create the appointment this code would 
need to be run locally on the Exchange server your targeting because its 
using Exoledb

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

Cheers
Glen

"Siva"  wrote in message 
news:L4-dnXbBTsG3MRLeRVn-rA@comcast.com...
> Hi Guys -
> Is there a way to programmatically recurse a mailbox store and create a 
> calendar entry for all the mailboxes in that store?
> Is there a 3rd party software that would do this?
>
> If it can be scripted, any samples or pointers? Thanks for your time...
>
date: Mon, 5 Dec 2005 10:30:20 +1100   author:   Glen Scales [MVP]

Re: Programmatically Create Calendar Items in mailbox store   
Thank you - Very much!

"Glen Scales [MVP]"  wrote in message 
news:uVtOzqS%23FHA.2320@TK2MSFTNGP11.phx.gbl...
> One way would be to use a combination of ADSI to work out what mailboxes 
> are on the server and then use CDOEX to create the appointment this code 
> would need to be run locally on the Exchange server your targeting because 
> its using Exoledb
>
> 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
>
> Cheers
> Glen
>
> "Siva"  wrote in message 
> news:L4-dnXbBTsG3MRLeRVn-rA@comcast.com...
>> Hi Guys -
>> Is there a way to programmatically recurse a mailbox store and create a 
>> calendar entry for all the mailboxes in that store?
>> Is there a 3rd party software that would do this?
>>
>> If it can be scripted, any samples or pointers? Thanks for your time...
>>
>
>
date: Mon, 5 Dec 2005 16:00:12 -0500   author:   Siva

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us