Alpha DevCon 2018
Page 1 of 2 12 LastLast
Results 1 to 30 of 51

Thread: Outlook Calendar and Tasks

  1. #1
    Member
    Real Name
    Troy
    Join Date
    May 2003
    Posts
    89

    Default Outlook Calendar and Tasks

    I am working on integrating outlook with my application but cannot get tasks or calendar items to appear. I have various VB scripts that do this but cannot get them to execute correctly within Alpha.

    Origional VB Script------------------------------
    Code:
    Const olAppointmentItem = 1
    
    Set objOutlook = CreateObject("Outlook.Application")
    Set objAppointment = objOutlook.CreateItem(olAppointmentItem)
    
    objAppointment.Start = #1/16/2007 11:00 AM#
    objAppointment.Duration = 60
    objAppointment.Subject = "Test Appointment"
    objAppointment.Body = "Test Body."
    objAppointment.Location = "44/2039"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = True
     
    objAppointment.Save
    ------------------End VB

    Now if I try to do this in Alpha it fails
    Code:
    dim objOutlook as P
    
    objOutlook = ole.create("Outlook.Application")
    objAppointment = objOutlook.ole.create(olAppointmentItem)
    
    objAppointment.Start = "#1/16/2007 11:00 AM#"
    objAppointment.Duration = 60
    objAppointment.Subject = "Test Appointment"
    objAppointment.Body = "Test Body."
    objAppointment.Location = "44/2039"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = True
     
    objAppointment.Save
    I'm a newbe to xbasic so bare with me.
    Thanks In Advance.
    Last edited by AaronBBrown; 01-22-2007 at 03:54 PM.

  2. #2
    Moderator
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,516

    Default Re: Outlook Calendar and Tasks

    I haven't tried what you're doing, but this may also work:

    A5_Run_VBScript()

    Check the help docs

    - Steve

    Later -- Ahh, I see Aaron has pitched in. Ignore mine and look at his.
    Last edited by Steve Workings; 01-22-2007 at 04:05 PM. Reason: Aaron is always right
    -Steve


  3. #3
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default Re: Outlook Calendar and Tasks

    Try this. You had a bunch of syntactic errors.

    Code:
    dim objOutlook as P
    
    objOutlook = ole.create("Outlook.Application")
    objAppointment = objOutlook.createitem(olAppointmentItem)
    
    objAppointment.Start = "1/16/2007 11:00 AM"
    objAppointment.Duration = 60
    objAppointment.Subject = "Test Appointment"
    objAppointment.Body = "Test Body."
    objAppointment.Location = "44/2039"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = .t.
     
    objAppointment.Save()
    [FONT=Tahoma][SIZE=1][COLOR=Blue]Aaron Brown
    Alpha Software Development Team[/COLOR][/SIZE][/FONT]

  4. #4
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: Outlook Calendar and Tasks

    Try this:

    Code:
    'Date Created: 22-Jan-2007 10:02:28 PM
    'Last Updated: 22-Jan-2007 10:23:11 PM
    'Created By  : Marcel Kollenaar
    'Updated By  : Marcel Kollenaar
    dim objOutlook as P
    
    constant olAppointmentItem = 1
    
    objOutlook = ole.GetObject("","Outlook.Application")
    'objOutlook = ole.create("Outlook.Application")
    objAppointment = objOutlook.CreateItem(olAppointmentItem)
    
    'objAppointment.Start = {16/1/2007 11:00 AM} 'Dutch time
    objAppointment.Start = {1/16/2007 11:00 AM} 'US time
    'objAppointment.Start = "#1/16/2007 11:00 AM#"
    objAppointment.Duration = 60
    objAppointment.Subject = "Test Appointment"
    objAppointment.Body = "Test Body."
    objAppointment.Location = "44/2039"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = .T.
    
    objAppointment.Save()
    I saw that Aaron has also answered your question while I was busy. :)

    I will give you some tips:

    On the right side of an assignment you must always use the Xbasic syntax.
    If you use constants like "olAppointmentItem" you have to lookup the value in the Outlook macro editor. Run the code with F8 until the row is highlighted and move the cursor over the constant. The value will appear.
    Methods are alway followed by a "()"
    Properties are referenced as they are: objAppointment.Body = "Test Body."
    Last edited by Marcel Kollenaar; 01-22-2007 at 04:44 PM.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  5. #5
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default Re: Outlook Calendar and Tasks

    Quote Originally Posted by Marcel Kollenaar View Post
    If you use constants like "olAppointmentItem" you have to lookup the value in the Outlook macro editor.
    Often, that is the case, but we do load some of the OLE constants, if they are made available in the type library.
    [FONT=Tahoma][SIZE=1][COLOR=Blue]Aaron Brown
    Alpha Software Development Team[/COLOR][/SIZE][/FONT]

  6. #6
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: Outlook Calendar and Tasks

    I use version 7 and had to declare it. Obviously it is not present in my type library. Aaron, where can I find the type library?
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  7. #7
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default Re: Outlook Calendar and Tasks

    Quote Originally Posted by Marcel Kollenaar View Post
    I use version 7 and had to declare it. Obviously it is not present in my type library. Aaron, where can I find the type library?
    It's part of the OLE object. There's nothing you can do in this case.
    [FONT=Tahoma][SIZE=1][COLOR=Blue]Aaron Brown
    Alpha Software Development Team[/COLOR][/SIZE][/FONT]

  8. #8
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: Outlook Calendar and Tasks

    Ok, but why do I have to declare the constant and if I look at your code you can do it without an explicit constant declaration.

    Don't I use the same OLE object? Office 2003, Outlook?
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  9. #9
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default Re: Outlook Calendar and Tasks

    Quote Originally Posted by Marcel Kollenaar View Post
    Ok, but why do I have to declare the constant and if I look at your code you can do it without an explicit constant declaration.

    Don't I use the same OLE object? Office 2003, Outlook?
    I don't know why you needed to declare the constant and I didn't.
    [FONT=Tahoma][SIZE=1][COLOR=Blue]Aaron Brown
    Alpha Software Development Team[/COLOR][/SIZE][/FONT]

  10. #10
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: Outlook Calendar and Tasks

    Aaron I get the next message: Attachment 13125
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  11. #11
    Member
    Real Name
    Troy
    Join Date
    May 2003
    Posts
    89

    Default Re: Outlook Calendar and Tasks

    Aarons Script worked great! Thank both of you guys for the help. There was very little documentation in the forums on this. I found a complete list of many functions that may help future people integrate with outlook. http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

    Thanks Again!

  12. #12
    Member
    Real Name
    Troy
    Join Date
    May 2003
    Posts
    89

    Default Re: Outlook Calendar and Tasks

    I do have another machine I recieved the same script error as Marcel though. I will look into it.

  13. #13
    Member
    Real Name
    Troy
    Join Date
    May 2003
    Posts
    89

    Default Re: Outlook Calendar and Tasks

    I have been working on away to get this to work but cannot. Aarons script runs fine in V6 but not on our V5 computers. Upgrading from our unlimited runtime of v5 would cost a fortune so that is not an option.

    I have explored trying to pass variables to vb script, but nothing seems to work. Mercel's script errors out on GetObject and Aarons "cannot find olAppointment".

  14. #14
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,626

    Default Re: Outlook Calendar and Tasks

    You've posted in the version 7 area. There are very significant differences in the OLE implementation between version 5 and 7. It is possible you may not be able to do this in version 5.

    Quote Originally Posted by bergmd View Post
    I have been working on away to get this to work but cannot. Aarons script runs fine in V6 but not on our V5 computers. Upgrading from our unlimited runtime of v5 would cost a fortune so that is not an option.

    I have explored trying to pass variables to vb script, but nothing seems to work. Mercel's script errors out on GetObject and Aarons "cannot find olAppointment".

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

  15. #15
    Member
    Real Name
    Tom Zulfi
    Join Date
    Sep 2008
    Posts
    27

    Default Re: Outlook Calendar and Tasks

    I am new in Alpha Five, can anyone send me ready application for outlook integration, be honest with you I do not understand any of following instructions.

    thanks.

  16. #16
    Member
    Real Name
    David Cassar
    Join Date
    May 2006
    Location
    Melbourne
    Posts
    9

    Default Re: Outlook Calendar and Tasks

    Hi

    I found Aarons scripts worked perfectly. The only thing I would like to be able to do further is set the date and time of the appointment based on a field the user user defines called flag_date.

    Can the objAppointment.Start value be set dynamically?

    Dave Cassar

  17. #17
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    887

    Default Re: Outlook Calendar and Tasks

    Quote Originally Posted by cassard View Post
    Hi

    Can the objAppointment.Start value be set dynamically?

    Dave Cassar
    Yes, but part of the trick is that Outlook is in universal time, so you need to get the time offset (I wrote a function to do this).

  18. #18
    Member
    Real Name
    David Cassar
    Join Date
    May 2006
    Location
    Melbourne
    Posts
    9

    Default Re: Outlook Calendar and Tasks

    Hi Garry,


    Yes, but part of the trick is that Outlook is in universal time, so you need to get the time offset
    Could you elaborate. What do you mean by the time offset?

    Any chance I could get a copy of your function?

    Thanks

  19. #19
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    887

    Default Re: Outlook Calendar and Tasks

    Dave,
    Think of universal time (UT) as like Greenwich Mean Time - Google universal time to get a good explanation. When you put an appointment into Outlook programmatically it takes the value as UT, so Melbourne is say 10 hrs ahead of MGT and UT. So an appointment for 11am Melbourne time is 1 am UT which is the value you must programmatically put into the applointment. Windows knows your time zone and hence the "offset" and displays it in your calendar as 11am!
    Look at the Alpha function gettimezoneoffset().
    Upon checking my records, the code I wrote was not a fuction but was to send an appointment (*.vcs file) to someone via email - see http://msgboard.alphasoftware.com/al...universal+time

  20. #20
    Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,716

    Default Re: Outlook Calendar and Tasks

    Is there a way to get this to work from the WAS? More specifically, it DOES work from the WAS but updates the Outlook Calendar that exists on the WASS machine - not what I want. I want the user to be able to run the script and have it update the outlook calendar on THEIR computer.
    Gary S. Traub, Ph.D.


  21. #21
    Member
    Real Name
    david
    Join Date
    Jan 2013
    Posts
    17

    Default Re: Outlook Calendar and Tasks

    Hi everyone im a newbie but i have found the code really good but how can i set it up so that the date for the appointment is the same as the field in a form in the table its called tuning date and the table is called customer how can i do this also want the body to me the notes nowing this would help a million as currently print screening everything which is stupid in my eyes and time consuming when changing dates thanks in advance

  22. #22
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,017

    Default Re: Outlook Calendar and Tasks

    David,

    how can i set it up so that the date for the appointment is the same as the field in a form in the table
    from Post #3 code and fill in your table info with using the Filter -- find the records which you need.

    dim objOutlook as P

    objOutlook = ole.create("Outlook.Application")
    objAppointment = objOutlook.createitem(olAppointmentItem)

    objAppointment.Start = "1/16/2007 11:00 AM" <--- your table field name or set to Variables
    objAppointment.Duration = 60
    objAppointment.Subject = "Test Appointment"
    objAppointment.Body = "Test Body."
    objAppointment.Location = "44/2039"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = .t.

    objAppointment.Save()

  23. #23
    Member
    Real Name
    david
    Join Date
    Jan 2013
    Posts
    17

    Default Re: Outlook Calendar and Tasks

    excellent thanks a million my next qustion is how can i have a button that will go to a customers own folder i have on a server this is what i have so far

    '//Open the explorer

    sys_shell("explorer /e,/root,X:\\")

    my table name is "Customers" and the unique id is "Customer_ID" there will a folder for each of them named with there id number ideally i would love it if iy would create it if there is not one aswell

    many thanks

    from the newb of the century

    :D

  24. #24
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,017

    Default Re: Outlook Calendar and Tasks

    David,

    Review this " File Functions and Methods " from the help and this forum.
    I had the experience for Creating a folder but not opening yet. I still have the conception problem.

  25. #25
    Member
    Real Name
    david
    Join Date
    Jan 2013
    Posts
    17

    Default Re: Outlook Calendar and Tasks

    ok hello everyone again

    heres a question for you ive figured out most things in alpha five now but i was wondering and experimenting with this one at the moment

    i have set up a button to through info across to outlook no probs from a forms (with currently displayed info ) what i want to find out now is in the body of the appoinment i want to put all the records i have for customer 23 appoinments into the body from my table called appoinments i have tryed creating pdfs etc but no luck i am stumped at the moment any insight on this would be great

    dave

    (sorry for my spelling and grammar )

  26. #26
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,953

    Default Re: Outlook Calendar and Tasks

    Better try explaining again. You want to put all outlook appointments for one customer into where? Or you want to put all records from your table or one customer somewhere?
    There can be only one.

  27. #27
    Member
    Real Name
    david
    Join Date
    Jan 2013
    Posts
    17

    Default Re: Outlook Calendar and Tasks

    ok so heres what im trying to do

    when i make an appoinment i can inout accross all the fields i have currently on my form easy

    however i have a table linked to my customer table with a id of customer number to link all the appoinments i have created to therer corresponding customer so a customer might have had several appoinments in the past say 1a, 2a, 3a, now when i make appointment 4a --- i can make 4a info go accross onto outlokk straight from the form open however i cant put the past ones in also as they are not shown when making new one but i require this info so that my engineers can se what has been done in the past

    how can i do this

    probally not explained well agin but have been under the weather for a long time know and that is the reason also in delay responding thanks for your help

  28. #28
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,953

    Default Re: Outlook Calendar and Tasks

    A form displays one record at a time. A browse displays multiple records in spreadsheet type format. Your description sounds like you want a browse of the "table linked to my customer table" on the form.

    If the form is based on a set where the customer table is the parent then it should be as easy as using the Object menu while in form design mode, choose New, select Browse, and choose the appointments table.
    There can be only one.

  29. #29
    Member
    Real Name
    david
    Join Date
    Jan 2013
    Posts
    17

    Default Re: Outlook Calendar and Tasks

    Quote Originally Posted by Stan Mathews View Post
    A form displays one record at a time. A browse displays multiple records in spreadsheet type format. Your description sounds like you want a browse of the "table linked to my customer table" on the form.

    If the form is based on a set where the customer table is the parent then it should be as easy as using the Object menu while in form design mode, choose New, select Browse, and choose the appointments table.
    hi thanks for the response i have done this sorry didnt explain it properly ------ i want this information transferd to outlook appoinment including the past appoinmnets when i press the booking of the appointment

  30. #30
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,953

    Default Re: Outlook Calendar and Tasks

    Without seeing the code you are using now I can only describe what you need to do.

    You have code that copies info from the appointments table to outlook. You need to modify that code so that instead of copying the current selected record it loops through all of the child table records linked to the current parent.

    Given a browse on a form the child may be referenced as

    table.current(#)

    where # is the vertical position of the child table as viewed in the Edit Set genie. Since only the child table records linked to the current parent are accessible you can (assuming nothing interferes)

    tbl = table.current(#)
    tbl.fetch_first()
    while .not. tbl.fetch_eof()
    'your present code goes here
    tbl.fetch_next()
    end while
    There can be only one.

Similar Threads

  1. Repeated Tasks using a Date calc.
    By Alan Lucas in forum Alpha Five Version 6
    Replies: 2
    Last Post: 06-08-2005, 06:01 AM
  2. Have email use Outlook instead of Outlook Express
    By George Corder in forum Alpha Five Version 5
    Replies: 2
    Last Post: 12-24-2004, 02:52 PM
  3. Calendar Add In - Day Calendar
    By scottly in forum Alpha Five Version 5
    Replies: 1
    Last Post: 08-08-2003, 07:58 AM
  4. Can A5 v4 integrate w/Outlook or another Calendar/
    By Harv Tretsky in forum Code Archive
    Replies: 18
    Last Post: 07-24-2003, 09:00 PM
  5. Sent emails using Outlook
    By Rick Valenzuela in forum Alpha Five Version 5
    Replies: 1
    Last Post: 11-04-2002, 01:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •