Solved

Insert in Outlook Calendar with VFP

Posted on 2013-06-01
3
1,178 Views
Last Modified: 2013-06-28
I have an application written in VFP that need to insert data in Outlook Calendar for other users (not in the user's own calendar).

And another application that needs to choose one among the many created calendars on the user account (example: personal, professional, school ...). Is it possible?

Translate from portuguese:

"Eu tenho um aplicativo escrito em VFP que precisa inserir dados no Calendario do Outlook de outros usuários ( não no calendário do próprio usuário ).

E um outro aplicativo que precisa escolher um entre os diversos calendários criados na conta do usuário ( exemplo: pessoal, profissional, escolar ... ). É possível ? "
0
Comment
Question by:etm_wkl
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 39268513
As a starter you can do:
o = CREATEOBJECT("outlook.application")
oMapi = o.GetNamespace("Mapi")
? oMapi.Logon("Profile name","password")

Open in new window

But you need to add the outlook pst accounts to your outlook. If you want to address a user you don't have access to it's pst file, then you can only send an appointment request.

That means you create a appointment item, add recipients and send the appointment, like this:
#DEFINE olAppointmentItem  1
#DEFINE olMeeting  1
#DEFINE olRequired  1
#DEFINE olOptional  2

* further outlook constants see http://fox.wikis.com/wc.dll?Wiki~OutlookConstants
* or use object browsers, open the Microsoft Outlook X.00 Object Libary (X depends on whatever your version is) and drag the Constants node into a prg for a full list

oOutlook = CreateObject("Outlook.Application")
oAppointment = oOutlook.CreateItem(olAppointmentItem)

oAppointment.MeetingStatus = olMeeting
oAppointment.Subject = "Strategy Meeting"
oAppointment.Location = "Conference Room B"
oAppointment.Start = Datetime(2013,07,01,10,00,00)
oAppointment.Duration = 90
oAppointment.Body = "My Agenda..."
oRequiredAttendee = oAppointment.Recipients.Add("someone@example.com")
oRequiredAttendee.Type = olRequired
oOptionalAttendee = oAppointment.Recipients.Add("anotherone@somwhere.com")
oOptionalAttendee.Type = olOptional
oAppointment.Send()

Open in new window


If you need more control any your company hosts an exchange server, that's the place to manage calenders of employees, not your outlook client. You'd do that server side. Outlook automation is not what helps you with that.

Bye, Olaf.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 39283603
BUMP

I've extended my answer. Just want to ensure you get noticed.

Bye, Olaf.
0
 

Author Closing Comment

by:etm_wkl
ID: 39284013
Thanks a lot.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't know how to downgrade, my instructions below should be helpful.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question