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!

outlook appointment startdate field not in linked table

Status
Not open for further replies.

andytodd

Technical User
May 17, 2002
18
0
0
GB
Hi,

I have to select, insert, delete and update a database and a Outlook calendar in a public folder in such a way that they either have (or appear to have) the same datastore.

I have automated Outlook 2000 to send emails, and can write appointments from Access 2000.

Am now trying to read information out of an Outlook public folder containing appointments. I can link to the folder, but the resultant table does not (seem to) contain any time and date information. The data is quite useless without time information.

Any ideas as to a solution?
 
Andy,

I was working on the same type of application last month. Seems that there is very little documentation on this.

If you copy and paste the code that you use to write the appointment, I will try to show you how to then get the Time and Date information back from outlook using the same basic logic.

Just Cop and paste your code into the response.

I am sure can Help You,
Hap [2thumbsup]


Access Developer [pc] - [americanflag]
Specializing in Access based Add-on Solutions for the Developer
 
Hi Hap,

The main requirement is to synchronise so rooms are not double booked, and if that works, the Head of Dept will use the same approach to check for tutor clashes. admin people do not want to include all random room use in the Staff Training database.

The code used to write appointments follows.

It works as it stands, although the lines finding the room bookings folder are commented out in the live version. The db and Outlook run 24/7 on at least one machine.

By linking to the Outlook folder, I can read, partial update and delete.
If I use a flag in the subject, I can determine which records are courses, as opposed to random items, but I can't tell Course A run 1 starting at 9am from Course A, run 2 starting at 2pm. No times are visible at all.

Thanks for any assitance you can give.



Public Sub AddToOutlook(apptSubject As String, Optional apptDescription As String, _
Optional StartDate As Date, Optional StartTime As Date, _
Optional EndTime As Date, Optional apptLocation As String, Optional apptCategories As String)


' Subroutine opens outlook (or grabs it, and puts an
' appointment into the user's calendar.
'
' the user has to copy the item into the public folder!
' This is a pain, but one button writes all upcoming courses from the database
' into the calendar with a new category id. The whole process is about 4 user
' steps and takes about 60 seconds, which has been adequate thus far.
'
' New requirement is for Access and Outlook to be interfaced in such a way that
' any change to either is checked against the other, and changes are reflected in both.

Dim objOutlook As Outlook.Application
Dim olns As Object
Dim objAppt As Outlook.AppointmentItem
Dim MyFolder1 As Object
Dim MyFolder2 As Object
Dim MyFolder3 As Object



' Wake up Outlook or grab hold of it as Outlook should
' only be open once per machine

Set objOutlook = CreateObject("Outlook.Application")
Set olns = objOutlook.GetNamespace("MAPI")


' Create an appointment item. This will appear in the user's
' calendar as so far unable to create in a public folder, even
' if the user is the owner of the public folder

Set objAppt = objOutlook.CreateItem(olAppointmentItem)


' Set a route for the Public folder we want
' These lines find the folder, however can't create a new appointment item
' at present

Set MyFolder1 = olns.Folders("Public Folders")
Set MyFolder2 = MyFolder1.Folders("All Public Folders")
Set MyFolder3 = MyFolder2.Folders("Room Bookings")


' Open the new appointment item, and fill out the fields

With objAppt

' all courses have a subject, a date and times
.Start = StartDate & " " & StartTime
.Duration = (EndTime - StartTime) * 24 * 60
.subject = apptSubject

If Not IsNull(apptDescription) Then .body = apptDescription
If Not IsNull(apptLocation) Then .location = apptLocation
If Not IsNull(apptCategories) Then .categories = apptCategories

'save the appointment, and then close it, saving again for good measure!

.Save
.Close olSave
End With



End Sub
 
Andy,

Well, the code to write the appointment looks fine.
I tried and it seems to work here.

Shame on me, but I should have asked you to also
Copy and paste the code that you are using to read the appointment. (Especially the date and time/duration)

Note: Dates are tricky when using Access.

Also, what is a normal duration that might be entered by your users.

Talk to you soon,
Hap [2thumbsup]


Access Developer [pc] - [americanflag]
Specializing in Access based Add-on Solutions for the Developer
 
Hi Hap and any one else interested,

I've been searching all of today (it's 5pm here), and can now read from a public folder using:

Code:
    Set olItems = MyFolder3.Items.GetFirst
after setting the path and removing
Code:
Set objAppt = objOutlook.CreateItem(olAppointmentItem)

So far I can't sort or include recurrences, but I'm experimenting with different styles of approach, and with the idea of a personal calendar being used, as other users could have permissions.....

Any thoughts would be appreciated
 
Andy,

Are you still having problems with retreiving date and time duration. IF so copy and paste that code that you are using to read the appointment. (Especially the date and time/duration).

Regarding recurring appointments, that info is only available for a specified time in the future. Those entries are generated as you move forward in time. I read about that some where on line and will see if I can locate that address.

Talk Soon,
Hap


Access Developer [pc] - [americanflag]
Specializing in Access based Add-on Solutions for the Developer
 
Just got it to sort and add in recurring items. problem with recurrances is they seem to recurr ad infinitum.

So far it thinks my boss will get to be 1250 years old.

Hmmmmmm

When I get it out of the loop it is in now, I'll paste up the how on the FAQ
 
Andy,

Did you solve your problem?

I would love to see how you resolved the date issue.

I would also like to see how you are reading the necessary appointment record.

Did you write the FAQS?

If not, can you paste that code here for me to examine?

Many Thanks,
Hap





Access Developer [pc] - [americanflag]
Specializing in Access based Add-on Solutions for the Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top