|
Home > Archive > FoxPro Help and Support > January 2006 > how to display a screen for a user to select a contact from the MS OutLook Addressbook
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to display a screen for a user to select a contact from the MS OutLook Addressbook
|
|
| LeAnne 2006-01-08, 3:24 am |
| Does anyone know how i could (in vfp) display a MS Outlook screen which can
be used for the user to select a contact.
I need a screen to display the outlook contacts and for the user to select
one of them and this screen should return the selected contact.
Then i should be able to get the details of this selected contact.
Any idea???
| |
| Mike Gagnon 2006-01-08, 9:23 am |
| Create a grid on a form based on the following cursor
#DEFINE olFolderContacts 10
ON ERROR *
CREATE CURSOR myCursor (Name c(40),email c(50))
LOCAL oOutlook,oNameSpace,
oDefaultFolder
oOutlook = CREATEOBJECT('outloo
k.application')
oNameSpace = oOutlook. getnamespace('MAPI')
oDefaultFolder=oName
Space. GetDefaultFolder(olF
olderContacts)
oItems = oDefaultFolder.items
FOR EACH oItem IN oItems
INSERT INTO myCursor (name,email) VALUES
(oItem.fullname,oItem.email1address)
ENDFOR
SELECT myCursor
BROWSE NORMAL
"LeAnne" <Anne@bogusemail.com> wrote in message
news:Ow7M2sCFGHA.2036@TK2MSFTNGP14.phx.gbl...
> Does anyone know how i could (in vfp) display a MS Outlook screen which
> can be used for the user to select a contact.
> I need a screen to display the outlook contacts and for the user to select
> one of them and this screen should return the selected contact.
>
> Then i should be able to get the details of this selected contact.
>
> Any idea???
>
>
| |
|
| Just what i didn't want to do. But if this is the only option, then so be
it.
I was looking for a screen in OutLook itself..
"Mike Gagnon" <mgagnon23@hotmail.com> wrote in message
news:OwAarcFFGHA.1760@TK2MSFTNGP10.phx.gbl...
> Create a grid on a form based on the following cursor
>
> #DEFINE olFolderContacts 10
>
> ON ERROR *
>
> CREATE CURSOR myCursor (Name c(40),email c(50))
>
> LOCAL oOutlook,oNameSpace,
oDefaultFolder
>
> oOutlook = CREATEOBJECT('outloo
k.application')
>
> oNameSpace = oOutlook. getnamespace('MAPI')
>
> oDefaultFolder=oName
Space. GetDefaultFolder(olF
olderContacts)
>
> oItems = oDefaultFolder.items
>
> FOR EACH oItem IN oItems
>
> INSERT INTO myCursor (name,email) VALUES
> (oItem.fullname,oItem.email1address)
>
> ENDFOR
>
> SELECT myCursor
>
> BROWSE NORMAL
>
>
> "LeAnne" <Anne@bogusemail.com> wrote in message
> news:Ow7M2sCFGHA.2036@TK2MSFTNGP14.phx.gbl...
>
>
| |
| Mike Gagnon 2006-01-09, 7:24 am |
| You can use the Outlook activex, but the problem is, once you make your
selection FoxPro does not know what that selection is.
Public oform1
oform1=createobject(
"form1")
oform1.Show
Return
********************
********************
**************
Define Class form1 As Form
Height = 400
Width = 620
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
Add Object cmdExit As CommandButton With ;
Top = 330, ;
Left = 504, ;
Height = 27, ;
Width = 84, ;
Caption = "E\<xit", ;
Name = "CmdExit"
Add Object cmdCalendar As CommandButton With ;
Top = 330, ;
Left = 12, ;
Height = 27, ;
Width = 84, ;
Caption = "\<Calendar", ;
Name = "CmdCalendar"
Add Object cmdInBox As CommandButton With ;
Top = 330, ;
Left = 108, ;
Height = 27, ;
Width = 84, ;
Caption = "\<In Box", ;
Name = "CmdInBox"
Add Object cmdSent As CommandButton With ;
Top = 330, ;
Left = 204, ;
Height = 27, ;
Width = 84, ;
Caption = "\<Sent Mail", ;
Name = "CmdSent"
Add Object cmdContact As CommandButton With ;
Top = 330, ;
Left = 300, ;
Height = 27, ;
Width = 84, ;
Caption = "\<AddressBook", ;
Name = "CmdContact"
Add Object cmdNewMail As CommandButton With ;
Top = 360, ;
Left =12 , ;
Height = 27, ;
Width = 84, ;
Caption = "New \<Mail", ;
Name = "cmdNewMail"
Add Object cmdNewTask As CommandButton With ;
Top = 360, ;
Left =108 , ;
Height = 27, ;
Width = 84, ;
Caption = "New \<Task", ;
Name = "cmdNewTask"
Add Object cmdNewContact As CommandButton With ;
Top = 360, ;
Left =204 , ;
Height = 27, ;
Width = 84, ;
Caption = "\<New Contact", ;
Name = "cmdNewContact"
Add Object cmdNewAppointment As CommandButton With ;
Top = 360, ;
Left =300 , ;
Height = 27, ;
Width = 110, ;
Caption = "New A\<ppointment", ;
Name = "cmdNewAppointment"
Add Object olecontrol1 As OleControl With ;
Top = 12, ;
Left = 12, ;
Height = 306, ;
Width = 588, ;
Name = "Olecontrol1", ;
OleClass = "OVCtl.OVCtl.1"
Procedure cmdExit.Click
Thisform.Release()
Endproc
Procedure cmdNewMail.Click
Thisform.olecontrol1.NewMessage()
ENDPROC
Procedure cmdNewTask.Click
Thisform.olecontrol1.NewTask()
Endproc
Procedure cmdNewContact.Click
Thisform.olecontrol1.NewContact()
ENDPROC
Procedure cmdNewAppointment.Click
Thisform.olecontrol1.NewAppointment()
Endproc
Procedure cmdCalendar.Click
Thisform.olecontrol1.Folder = "CALENDAR"
Thisform.Caption = "OutLook Calendar"
Thisform.Refresh()
Endproc
Procedure cmdInBox.Click
Thisform.olecontrol1.Folder = "INBOX"
Thisform.Caption = "OutLook InBox"
Thisform.Refresh()
Endproc
Procedure cmdSent.Click
Thisform.olecontrol1.Folder = "SENT ITEMS"
Thisform.Caption = "OutLook Sent Items"
Thisform.Refresh()
Endproc
Procedure cmdContact.Click
Thisform.olecontrol1.Folder = "CONTACTS"
Thisform.Caption = "OutLook Address Book"
Thisform.Refresh()
Endproc
Procedure olecontrol1.Init
This.Folder = "InBox"
Endproc
Enddefine
"Nikki" <castelo@geo.un> wrote in message
news:Oy4rCEKFGHA.916@TK2MSFTNGP10.phx.gbl...
> Just what i didn't want to do. But if this is the only option, then so be
> it.
> I was looking for a screen in OutLook itself..
>
> "Mike Gagnon" <mgagnon23@hotmail.com> wrote in message
> news:OwAarcFFGHA.1760@TK2MSFTNGP10.phx.gbl...
>
>
| |
|
|
|
|
|