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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 9th 08, 02:50 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Outlook Calendar

Hey

I'm working with automation in the outlook calendar (MS Access using
visual basic).

My goal is to put appointments into a shared calendar - I'm looping
through a database, finding numerous funerals - maybe 3-4 each day,
and want to put them into a shared calendar shared by all the workers
on the funeral parlour.

I've achieved
putting them into the default calendar, but I want it to go into
another one - let's say it's name is "Shared Calendar". I've been
trying lot of things without success - here is my code that puts it
into the default calendar. How do I get it to put the appointments
into a shared calendar ?

I tried to use:

Set ocalItems = oNameSpace.Folder("Shared Calendar").Items

instead of

Set ocalItems = oNameSpace.GetDefaultFolder(olFolderCalendar).Item s

Below is my code that works for the default calendar in outlook .
Sorry if I sound n00bish. And btw - you got any tutorials, books I can
read on this topic to get a better understanding I would highly
appreciate it.

Hope any of you bright minds can help

regards
Vegard

------------------------------------------------------------------------------------------------------

Dim oOutlook As New outlook.Application

Dim oNameSpace As NameSpace
Dim Appointment As Object
Dim ocalItems As Items
Dim AppointmentDate As String
Dim rs As Recordset
Dim db As Database
Dim sql As String
Dim today As Date
Dim myRecipient As outlook.Recipient
Dim olApp As outlook.Application

today = Now()

Set oNameSpace = oOutlook.GetNamespace("MAPI")

Set ocalItems = oNameSpace.GetDefaultFolder(olFolderCalendar).Item s
AppointmentDate = Now() - 1
Set Appointment = ocalItems.GetFirst

Do While Not (Appointment Is Nothing)
If Appointment.Start AppointmentDate Then
Appointment.Delete
End If
Set Appointment = ocalItems.GetNext

Loop

Set olApp = CreateObject("Outlook.Application")

Set olAppt = olApp.CreateItem(olAppointmentItem)

' Set start time for 2-minutes from now...
'olAppt.Start = Now() + (2# / 24# / 60#)
olAppt.Start = Format(rs("dato_begravelse") & " " &
rs("klokkeslett_begravelse"), "dd/mm/yyyy hh:mm")

' Setup other appointment information...
With olAppt
.Duration = 60
.Subject = "Begravelse"
.Body = "Begravelse for " & rs("fornavn_avdøde") & " " &
rs("etternavn_avdøde")
.Location = rs("kirkenavn")
.ReminderMinutesBeforeStart = 15
.ReminderSet = True
End With

' Save Appointment...
olAppt.Save

Set olApp = Nothing

Set Appointment = Nothing
Set ocalItems = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
Ads
  #2  
Old February 10th 08, 02:20 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Outlook Calendar

To create a new item in a non-default folder programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class parameter is optional.

To create an item in another person's Calendar folder in an Exchange mailbox, use Namespace.GetSharedDefaultFolder to get the target MAPIFolder. Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Hey

I'm working with automation in the outlook calendar (MS Access using
visual basic).

My goal is to put appointments into a shared calendar - I'm looping
through a database, finding numerous funerals - maybe 3-4 each day,
and want to put them into a shared calendar shared by all the workers
on the funeral parlour.

I've achieved
putting them into the default calendar, but I want it to go into
another one - let's say it's name is "Shared Calendar". I've been
trying lot of things without success - here is my code that puts it
into the default calendar. How do I get it to put the appointments
into a shared calendar ?

I tried to use:

Set ocalItems = oNameSpace.Folder("Shared Calendar").Items

instead of

Set ocalItems = oNameSpace.GetDefaultFolder(olFolderCalendar).Item s

Below is my code that works for the default calendar in outlook .
Sorry if I sound n00bish. And btw - you got any tutorials, books I can
read on this topic to get a better understanding I would highly
appreciate it.

Hope any of you bright minds can help

regards
Vegard

------------------------------------------------------------------------------------------------------

Dim oOutlook As New outlook.Application

Dim oNameSpace As NameSpace
Dim Appointment As Object
Dim ocalItems As Items
Dim AppointmentDate As String
Dim rs As Recordset
Dim db As Database
Dim sql As String
Dim today As Date
Dim myRecipient As outlook.Recipient
Dim olApp As outlook.Application

today = Now()

Set oNameSpace = oOutlook.GetNamespace("MAPI")

Set ocalItems = oNameSpace.GetDefaultFolder(olFolderCalendar).Item s
AppointmentDate = Now() - 1
Set Appointment = ocalItems.GetFirst

Do While Not (Appointment Is Nothing)
If Appointment.Start AppointmentDate Then
Appointment.Delete
End If
Set Appointment = ocalItems.GetNext

Loop

Set olApp = CreateObject("Outlook.Application")

Set olAppt = olApp.CreateItem(olAppointmentItem)

' Set start time for 2-minutes from now...
'olAppt.Start = Now() + (2# / 24# / 60#)
olAppt.Start = Format(rs("dato_begravelse") & " " &
rs("klokkeslett_begravelse"), "dd/mm/yyyy hh:mm")

' Setup other appointment information...
With olAppt
.Duration = 60
.Subject = "Begravelse"
.Body = "Begravelse for " & rs("fornavn_avdøde") & " " &
rs("etternavn_avdøde")
.Location = rs("kirkenavn")
.ReminderMinutesBeforeStart = 15
.ReminderSet = True
End With

' Save Appointment...
olAppt.Save

Set olApp = Nothing

Set Appointment = Nothing
Set ocalItems = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
 




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
How to Synchronise Hotmail Calendar with Standard Outlook Calendar using Outlook Connector ?? Synapse Syndrome Outlook - General Queries 4 December 3rd 07 02:11 PM
Outlook 2002 appointment sent to public folder calendar gets puts in someone elses calendar instead QH Outlook - Calandaring 4 February 24th 06 06:14 PM
Outlook 2002: Opening appointment in Shared Calendar causes it to be copied into your own calendar QH Outlook - Calandaring 1 February 3rd 06 03:45 PM
Copy of Outlook 2002 appointment sent to Public Folder calendar gets to another calendar QH Outlook - Calandaring 1 February 2nd 06 03:45 PM
Outlook 2002 appointment sent to public folder calendar gets puts in someone elses calendar instead QH Outlook - General Queries 0 January 30th 06 03:02 PM


All times are GMT +1. The time now is 06:58 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.