A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Calendar Sharing without Exchange Server



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 29th 06, 10:34 AM posted to microsoft.public.outlook.program_vba
Shafiee
external usenet poster
 
Posts: 1
Default Outlook Calendar Sharing without Exchange Server

Hi,

I have written this code... to share the outlook calendar between two
computer. The code simply copies the calendar data from one computer to an
access database, which the other computer will use to load the appointments
from and vice versa. I need someone out there to test the code, and suggest
modifications, and the best way to run it without the end users knowledge.

To test it, you need to paste the code to a .vbs file, set up a system DSN
called "SharedAppointmentData" pointing to an access database with a table
named "Appointments" which contains the fields "EntryID, StartDate,
StartTime, EndDate, EndTime, Subject, Location, EntryID1".

Any suggestion is appreciated.

Best Regards,
Shafiee.

Here is the code:
-------------------------------------------------
'Initialize variables
Dim olapp
Dim amptitem
Dim olAppointmentItem
Dim olFolderCalendar
Dim MAPINamespace
Dim MAPIFolder

Dim conAppointments
Dim rstAppointments

Dim strSQL


olAppointmentItem = 1
olFolderCalendar = 9

on error resume next

InitializeObjects


Sub InitializeObjects()

'Gets the active instance of Outlook
Set olapp = GetObject(, "Outlook.Application")

'Exits the procedure if outlook is not open
if err.number 0 then
exit sub
end if

Set conAppointments = CreateObject("ADODB.Connection")
Set rstAppointments = CreateObject("ADODB.Recordset")

With conAppointments
..connectionstring = "dsn=SharedAppointmentData"
..open
End With


With rstAppointments
..activeconnection = conAppointments
..LockType = 3
..CursorType = 1
End With

WriteOutgoingAppointments

CreateIncomingAppointments

End Sub


'CreateAppointment False, "23/8/2006", "15:00", "23/8/2006", "15:30", "Test
appointment", "Test location"

'CheckOutgoingAppointments




Sub WriteOutgoingAppointments()
Set MAPINamespace = olapp.GetNamespace("MAPI")
Set MAPIFolder = MAPINamespace.GetDefaultFolder(olFolderCalendar)
for i = 1 to mapifolder.items.count
strSQL = "SELECT * FROM Appointments WHERE EntryID = '" &
mapifolder.items(i).EntryID & "'"
with rstAppointments
..source = strSQL
..open
end with

if rstAppointments.RecordCount = 0 then
with rstAppointments
..AddNew
..Fields("EntryID") = mapifolder.items(i).EntryID
..Fields("StartDate") = datevalue(mapifolder.items(i).Start)
..Fields("StartTime") = timevalue(mapifolder.items(i).Start)
..Fields("EndDate") = datevalue(mapifolder.items(i).End)
..Fields("EndTime") = timevalue(mapifolder.items(i).End)
..Fields("Subject") = mapifolder.items(i).Subject
..Fields("Location") = mapifolder.items(i).Location
..Update
end with
end if
rstAppointments.Close
next

End Sub


Sub CreateIncomingAppointments()
With rstAppointments
..source = "SELECT * FROM Appointments"
..open
End With



rstAppointments.MoveFirst
err.number = 0
For i = 1 to rstAppointments.RecordCount

on error resume next

MAPINamespace.GetItemFromID rstAppointments.Fields("EntryID").value

if err.number 0 then
err.number = 0

if isnull(rstAppointments.Fields("EntryID1").value) then
rstAppointments.Fields("EntryID1").value = CreateAppointment(False,
rstAppointments.Fields("StartDate"), rstAppointments.Fields("StartTime"),
rstAppointments.Fields("EndDate"), rstAppointments.Fields("EndTime"),
rstAppointments.Fields("Subject"), rstAppointments.Fields("Location"))
rstAppointments.update
end if
end if
rstAppointments.movenext
Next


rstAppointments.Close
End Sub

Function CreateAppointment(boolAllDayEvent, dtStart, tmStart, dtEnd, tmEnd,
strSubject, strLocation)
Set apmtitem = olapp.CreateItem(olAppointmentItem)
With apmtitem
..AllDayEvent = boolAllDayEvent
..Start = DateValue(dtStart) + TimeValue(tmStart)
..End = DateValue(dtEnd) + TimeValue(tmEnd)
..Subject = strSubject
..Location = strLocation
..Save
CreateAppointment = .EntryID
End With
End Function
------------------------------------



  #2  
Old August 31st 06, 11:38 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default Outlook Calendar Sharing without Exchange Server

Very complicated - it is more easy to use add-inn (there are many of
them in the web), for example:

http://shareo.4team.biz/?pcode=607180190pwkkd3 - allows to share not
only Calendar, but other folders as well

Try - really easy-to use tool


Shafiee wrote:
Hi,

I have written this code... to share the outlook calendar between two
computer. The code simply copies the calendar data from one computer to an
access database, which the other computer will use to load the appointments
from and vice versa. I need someone out there to test the code, and suggest
modifications, and the best way to run it without the end users knowledge.

To test it, you need to paste the code to a .vbs file, set up a system DSN
called "SharedAppointmentData" pointing to an access database with a table
named "Appointments" which contains the fields "EntryID, StartDate,
StartTime, EndDate, EndTime, Subject, Location, EntryID1".

Any suggestion is appreciated.

Best Regards,
Shafiee.

Here is the code:
-------------------------------------------------
'Initialize variables
Dim olapp
Dim amptitem
Dim olAppointmentItem
Dim olFolderCalendar
Dim MAPINamespace
Dim MAPIFolder

Dim conAppointments
Dim rstAppointments

Dim strSQL


olAppointmentItem = 1
olFolderCalendar = 9

on error resume next

InitializeObjects


Sub InitializeObjects()

'Gets the active instance of Outlook
Set olapp = GetObject(, "Outlook.Application")

'Exits the procedure if outlook is not open
if err.number 0 then
exit sub
end if

Set conAppointments = CreateObject("ADODB.Connection")
Set rstAppointments = CreateObject("ADODB.Recordset")

With conAppointments
.connectionstring = "dsn=SharedAppointmentData"
.open
End With


With rstAppointments
.activeconnection = conAppointments
.LockType = 3
.CursorType = 1
End With

WriteOutgoingAppointments

CreateIncomingAppointments

End Sub


'CreateAppointment False, "23/8/2006", "15:00", "23/8/2006", "15:30", "Test
appointment", "Test location"

'CheckOutgoingAppointments




Sub WriteOutgoingAppointments()
Set MAPINamespace = olapp.GetNamespace("MAPI")
Set MAPIFolder = MAPINamespace.GetDefaultFolder(olFolderCalendar)
for i = 1 to mapifolder.items.count
strSQL = "SELECT * FROM Appointments WHERE EntryID = '" &
mapifolder.items(i).EntryID & "'"
with rstAppointments
.source = strSQL
.open
end with

if rstAppointments.RecordCount = 0 then
with rstAppointments
.AddNew
.Fields("EntryID") = mapifolder.items(i).EntryID
.Fields("StartDate") = datevalue(mapifolder.items(i).Start)
.Fields("StartTime") = timevalue(mapifolder.items(i).Start)
.Fields("EndDate") = datevalue(mapifolder.items(i).End)
.Fields("EndTime") = timevalue(mapifolder.items(i).End)
.Fields("Subject") = mapifolder.items(i).Subject
.Fields("Location") = mapifolder.items(i).Location
.Update
end with
end if
rstAppointments.Close
next

End Sub


Sub CreateIncomingAppointments()
With rstAppointments
.source = "SELECT * FROM Appointments"
.open
End With



rstAppointments.MoveFirst
err.number = 0
For i = 1 to rstAppointments.RecordCount

on error resume next

MAPINamespace.GetItemFromID rstAppointments.Fields("EntryID").value

if err.number 0 then
err.number = 0

if isnull(rstAppointments.Fields("EntryID1").value) then
rstAppointments.Fields("EntryID1").value = CreateAppointment(False,
rstAppointments.Fields("StartDate"), rstAppointments.Fields("StartTime"),
rstAppointments.Fields("EndDate"), rstAppointments.Fields("EndTime"),
rstAppointments.Fields("Subject"), rstAppointments.Fields("Location"))
rstAppointments.update
end if
end if
rstAppointments.movenext
Next


rstAppointments.Close
End Sub

Function CreateAppointment(boolAllDayEvent, dtStart, tmStart, dtEnd, tmEnd,
strSubject, strLocation)
Set apmtitem = olapp.CreateItem(olAppointmentItem)
With apmtitem
.AllDayEvent = boolAllDayEvent
.Start = DateValue(dtStart) + TimeValue(tmStart)
.End = DateValue(dtEnd) + TimeValue(tmEnd)
.Subject = strSubject
.Location = strLocation
.Save
CreateAppointment = .EntryID
End With
End Function
------------------------------------


  #3  
Old September 5th 06, 11:06 AM posted to microsoft.public.outlook.program_vba
Jasy
external usenet poster
 
Posts: 12
Default Outlook Calendar Sharing without Exchange Server

Thank you Julia....

The software you have recommended really worth attention.... I also
have tried ShareCalendar.... I think we will be purchasing it... It is
cheaper... You can find out more he
http://sharecalendar.4team.biz/?pcode=6083101948f43tk

raše:
Very complicated - it is more easy to use add-inn (there are many of
them in the web), for example:

http://shareo.4team.biz/?pcode=607180190pwkkd3 - allows to share not
only Calendar, but other folders as well

Try - really easy-to use tool


Shafiee wrote:
Hi,

I have written this code... to share the outlook calendar between two
computer. The code simply copies the calendar data from one computer to an
access database, which the other computer will use to load the appointments
from and vice versa. I need someone out there to test the code, and suggest
modifications, and the best way to run it without the end users knowledge.

To test it, you need to paste the code to a .vbs file, set up a system DSN
called "SharedAppointmentData" pointing to an access database with a table
named "Appointments" which contains the fields "EntryID, StartDate,
StartTime, EndDate, EndTime, Subject, Location, EntryID1".

Any suggestion is appreciated.

Best Regards,
Shafiee.

Here is the code:
-------------------------------------------------
'Initialize variables
Dim olapp
Dim amptitem
Dim olAppointmentItem
Dim olFolderCalendar
Dim MAPINamespace
Dim MAPIFolder

Dim conAppointments
Dim rstAppointments

Dim strSQL


olAppointmentItem = 1
olFolderCalendar = 9

on error resume next

InitializeObjects


Sub InitializeObjects()

'Gets the active instance of Outlook
Set olapp = GetObject(, "Outlook.Application")

'Exits the procedure if outlook is not open
if err.number 0 then
exit sub
end if

Set conAppointments = CreateObject("ADODB.Connection")
Set rstAppointments = CreateObject("ADODB.Recordset")

With conAppointments
.connectionstring = "dsn=SharedAppointmentData"
.open
End With


With rstAppointments
.activeconnection = conAppointments
.LockType = 3
.CursorType = 1
End With

WriteOutgoingAppointments

CreateIncomingAppointments

End Sub


'CreateAppointment False, "23/8/2006", "15:00", "23/8/2006", "15:30", "Test
appointment", "Test location"

'CheckOutgoingAppointments




Sub WriteOutgoingAppointments()
Set MAPINamespace = olapp.GetNamespace("MAPI")
Set MAPIFolder = MAPINamespace.GetDefaultFolder(olFolderCalendar)
for i = 1 to mapifolder.items.count
strSQL = "SELECT * FROM Appointments WHERE EntryID = '" &
mapifolder.items(i).EntryID & "'"
with rstAppointments
.source = strSQL
.open
end with

if rstAppointments.RecordCount = 0 then
with rstAppointments
.AddNew
.Fields("EntryID") = mapifolder.items(i).EntryID
.Fields("StartDate") = datevalue(mapifolder.items(i).Start)
.Fields("StartTime") = timevalue(mapifolder.items(i).Start)
.Fields("EndDate") = datevalue(mapifolder.items(i).End)
.Fields("EndTime") = timevalue(mapifolder.items(i).End)
.Fields("Subject") = mapifolder.items(i).Subject
.Fields("Location") = mapifolder.items(i).Location
.Update
end with
end if
rstAppointments.Close
next

End Sub


Sub CreateIncomingAppointments()
With rstAppointments
.source = "SELECT * FROM Appointments"
.open
End With



rstAppointments.MoveFirst
err.number = 0
For i = 1 to rstAppointments.RecordCount

on error resume next

MAPINamespace.GetItemFromID rstAppointments.Fields("EntryID").value

if err.number 0 then
err.number = 0

if isnull(rstAppointments.Fields("EntryID1").value) then
rstAppointments.Fields("EntryID1").value = CreateAppointment(False,
rstAppointments.Fields("StartDate"), rstAppointments.Fields("StartTime"),
rstAppointments.Fields("EndDate"), rstAppointments.Fields("EndTime"),
rstAppointments.Fields("Subject"), rstAppointments.Fields("Location"))
rstAppointments.update
end if
end if
rstAppointments.movenext
Next


rstAppointments.Close
End Sub

Function CreateAppointment(boolAllDayEvent, dtStart, tmStart, dtEnd, tmEnd,
strSubject, strLocation)
Set apmtitem = olapp.CreateItem(olAppointmentItem)
With apmtitem
.AllDayEvent = boolAllDayEvent
.Start = DateValue(dtStart) + TimeValue(tmStart)
.End = DateValue(dtEnd) + TimeValue(tmEnd)
.Subject = strSubject
.Location = strLocation
.Save
CreateAppointment = .EntryID
End With
End Function
------------------------------------


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar Sharing Without Exchange Server Bill Glidden Outlook - General Queries 2 September 28th 06 10:08 PM
Sharing Outlook Contacts and E-mail folder on Exchange Server John Outlook - General Queries 4 July 27th 06 01:33 PM
Sharing calendar without Exchange Server Mats Outlook - Calandaring 0 April 12th 06 09:18 AM
SHARING CALENDAR W/O EXCHANGE SERVER smokiibear Outlook - General Queries 5 March 15th 06 07:28 PM
sharing contacts over a exchange server tmmm Outlook - Using Contacts 1 February 21st 06 10:37 AM


All times are GMT +1. The time now is 09:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.