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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sample OutLook in VFP Form 10

Status
Not open for further replies.
I wanted to add a New e-mail button to the code, but couldn't seem to find any info on the correct codes

eg

ThisForm.OleControl1.Folder = "CALENDAR"
(opens the OutLook Calendar)

and
ThisForm.OleControl1.Folder = "INBOX"
(opens the OutLook InBox)

and
ThisForm.OleControl1.Folder = "SENT ITEMS"
(opens the OutLook Sent Items)

and
ThisForm.OleControl1.Folder = "CONTACTS"
(opens the contacts and so on)


I tried...


PROCEDURE cmdNew.Click
ThisForm.OleControl1.Folder = &quot;NEW&quot; <----***
ThisForm.Caption = &quot;OutLook New e-mail&quot;
ThisForm.Refresh()
ENDPROC


(a rank guess on my part) but the line with the &quot;NEW&quot;<----*** is obviously the one which is key...

Can someone tell me where to find the correct codes for the other folders so I can access this point...

Also I have a outlook calender called CALANDER1...??

I searched the Microsoft page (and generally) with no joy...

John
 
John

Here is an example of making slight modifications to Ramani's code (Sorry Ramani, I couldn't help it), to add new things to different folders.
Code:
Public oform1
oform1=createobject(&quot;form1&quot;)
oform1.Show
Return
**************************************************
Define Class form1 As Form

	Height = 450
	Width = 620
	DoCreate = .T.
	Caption = &quot;Form1&quot;
	Name = &quot;Form1&quot;

	Add Object cmdExit As CommandButton With ;
		Top = 360, ;
		Left = 504, ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;E\<xit&quot;, ;
		Name = &quot;CmdExit&quot;

	Add Object cmdCalendar As CommandButton With ;
		Top = 360, ;
		Left = 12, ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<Calendar&quot;, ;
		Name = &quot;CmdCalendar&quot;

	Add Object cmdInBox As CommandButton With ;
		Top = 360, ;
		Left = 108, ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<In Box&quot;, ;
		Name = &quot;CmdInBox&quot;

	Add Object cmdSent As CommandButton With ;
		Top = 360, ;
		Left = 204, ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<Sent Mail&quot;, ;
		Name = &quot;CmdSent&quot;

	Add Object cmdContact As CommandButton With ;
		Top = 360, ;
		Left = 300, ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<AddressBook&quot;, ;
		Name = &quot;CmdContact&quot;
	Add Object cmdNewMail As CommandButton With ;
		Top = 405, ;
		Left =12 , ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<New Mail&quot;, ;
		Name = &quot;cmdNewMail&quot;
Add Object cmdNewTask As CommandButton With ;
		Top = 405, ;
		Left =108 , ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<New Task&quot;, ;
		Name = &quot;cmdNewTask&quot;
Add Object cmdNewContact As CommandButton With ;
		Top = 405, ;
		Left =204 , ;
		Height = 27, ;
		Width = 84, ;
		Caption = &quot;\<New Contact&quot;, ;
		Name = &quot;cmdNewContact&quot;
Add Object cmdNewAppointment As CommandButton With ;
		Top = 405, ;
		Left =300 , ;
		Height = 27, ;
		Width = 110, ;
		Caption = &quot;\<New Appointment&quot;, ;
		Name = &quot;cmdNewAppointment&quot;
	Add Object olecontrol1 As OleControl With ;
		Top = 12, ;
		Left = 12, ;
		Height = 336, ;
		Width = 588, ;
		Name = &quot;Olecontrol1&quot;, ;
		OleClass = &quot;OVCtl.OVCtl.1&quot;

	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 = &quot;CALENDAR&quot;
	Thisform.Caption = &quot;OutLook Calendar&quot;
	Thisform.Refresh()
Endproc

	Procedure cmdInBox.Click
	Thisform.olecontrol1.Folder = &quot;INBOX&quot;
	Thisform.Caption = &quot;OutLook InBox&quot;
	Thisform.Refresh()
Endproc

	Procedure cmdSent.Click
	Thisform.olecontrol1.Folder = &quot;SENT ITEMS&quot;
	Thisform.Caption = &quot;OutLook Sent Items&quot;
	Thisform.Refresh()
Endproc

	Procedure cmdContact.Click
	Thisform.olecontrol1.Folder = &quot;CONTACTS&quot;
	Thisform.Caption = &quot;OutLook Address Book&quot;
	Thisform.Refresh()
Endproc

	Procedure olecontrol1.Init
	This.Folder = &quot;InBox&quot;
Endproc

Enddefine

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike..

You are welcome.. (no need to feel sorry.. feel great).
I had come here with almost similar code.. but not all items you have added.. and about to post it here.. And you beat me in time. You have made my work quicker and this site is not permiting me to log on easily and when it does I get no time. :) Have a great day :)

ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Hi
Mikes Code modified.. to take care of Hot Keys and since I am reposting .. I also did some height adjustments.(I will also add some code later on for auto top/height of form and command buttons). Please all feel free to suggest modifications and post code patches. One of us will do the consolidation once a way to post complete code in the same thread. FAQ will follow after some time with due credit to Mike Gagnon who had shown keen interest to update this and other contributors.
**************************************************
Public oform1
oform1=createobject(&quot;form1&quot;)
oform1.Show
Return
**************************************************
Define Class form1 As Form

Height = 400
Width = 620
DoCreate = .T.
Caption = &quot;Form1&quot;
Name = &quot;Form1&quot;

Add Object cmdExit As CommandButton With ;
Top = 330, ;
Left = 504, ;
Height = 27, ;
Width = 84, ;
Caption = &quot;E\<xit&quot;, ;
Name = &quot;CmdExit&quot;

Add Object cmdCalendar As CommandButton With ;
Top = 330, ;
Left = 12, ;
Height = 27, ;
Width = 84, ;
Caption = &quot;\<Calendar&quot;, ;
Name = &quot;CmdCalendar&quot;

Add Object cmdInBox As CommandButton With ;
Top = 330, ;
Left = 108, ;
Height = 27, ;
Width = 84, ;
Caption = &quot;\<In Box&quot;, ;
Name = &quot;CmdInBox&quot;

Add Object cmdSent As CommandButton With ;
Top = 330, ;
Left = 204, ;
Height = 27, ;
Width = 84, ;
Caption = &quot;\<Sent Mail&quot;, ;
Name = &quot;CmdSent&quot;

Add Object cmdContact As CommandButton With ;
Top = 330, ;
Left = 300, ;
Height = 27, ;
Width = 84, ;
Caption = &quot;\<AddressBook&quot;, ;
Name = &quot;CmdContact&quot;

Add Object cmdNewMail As CommandButton With ;
Top = 360, ;
Left =12 , ;
Height = 27, ;
Width = 84, ;
Caption = &quot;New \<Mail&quot;, ;
Name = &quot;cmdNewMail&quot;

Add Object cmdNewTask As CommandButton With ;
Top = 360, ;
Left =108 , ;
Height = 27, ;
Width = 84, ;
Caption = &quot;New \<Task&quot;, ;
Name = &quot;cmdNewTask&quot;

Add Object cmdNewContact As CommandButton With ;
Top = 360, ;
Left =204 , ;
Height = 27, ;
Width = 84, ;
Caption = &quot;\<New Contact&quot;, ;
Name = &quot;cmdNewContact&quot;

Add Object cmdNewAppointment As CommandButton With ;
Top = 360, ;
Left =300 , ;
Height = 27, ;
Width = 110, ;
Caption = &quot;New A\<ppointment&quot;, ;
Name = &quot;cmdNewAppointment&quot;

Add Object olecontrol1 As OleControl With ;
Top = 12, ;
Left = 12, ;
Height = 306, ;
Width = 588, ;
Name = &quot;Olecontrol1&quot;, ;
OleClass = &quot;OVCtl.OVCtl.1&quot;

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 = &quot;CALENDAR&quot;
Thisform.Caption = &quot;OutLook Calendar&quot;
Thisform.Refresh()
Endproc

Procedure cmdInBox.Click
Thisform.olecontrol1.Folder = &quot;INBOX&quot;
Thisform.Caption = &quot;OutLook InBox&quot;
Thisform.Refresh()
Endproc

Procedure cmdSent.Click
Thisform.olecontrol1.Folder = &quot;SENT ITEMS&quot;
Thisform.Caption = &quot;OutLook Sent Items&quot;
Thisform.Refresh()
Endproc

Procedure cmdContact.Click
Thisform.olecontrol1.Folder = &quot;CONTACTS&quot;
Thisform.Caption = &quot;OutLook Address Book&quot;
Thisform.Refresh()
Endproc

Procedure olecontrol1.Init
This.Folder = &quot;InBox&quot;
Endproc

Enddefine
*******************************************************
** EOF
*******************************************************

ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Ramani

I wonder if this is of any use:
thisform.OLECONTROL1.newOfficeDocument()

Try it at your end and see what your get.
There is also
thisform.OLECONTROL1.newPost()
thisform.OLECONTROL1.newJournalEnry()
thisform.OLECONTROL1.newDefaultItem()
thisform.OLECONTROL1.newMeetingRequest()
thisform.OLECONTROL1.newNote()
thisform.OLECONTROL1.newTaskRequest()

thisform.OLECONTROL1.Open() && To Open an e-mail item.
thisform.OLECONTROL1.PrintItem()

Etc....


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Ramani

Its also interesting to note that the
thisform.OLECONTROL1.CustomizeView()

Works in VFP and save the settings for that option

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Still nobody didn't answer my question:

What if I want to show something under public folder?

Something Like:
-Public Folder
-All Public Folder
-XXX
-My Calendar

Where I want to show 'My Calendar'
 
skoko

Since this was a helpful hint, and the original post did not come from you, sometimes we forget some of questions that slip by. Next time you may consider starting a new thread, that way it will be treating as a question.

Where is this Public Folder located? Dos it appear in Outlook?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thats Ok, I didnt want to multiple same question.

Anyhow, Public Folder is in Outlook.

Structure is:

-Outlook Today - [Mailbox - user]
-Calendar
-Contacts
-Deleted Items
-Drafts
-Inbox
-Notes
-Outbox
-Send Items
-Tasks
-Public Folders
-Favorites
-All Public Folders
-XXX
-THIS_ONE <-----


 
skoko

Its pretty much like Windows explorer, or mapping to a network drive:
Try using:
this.oLECONTROL1.folder=&quot;\\Public Folders\Calendar\Favorites\XXX\THIS_ONE&quot; Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanx Mike, that was very helpful.
 
Please can anyone to write the all code for this problem?
I download .dll file and the procedure olecontrol1.init have one error.

Procedure olecontrol1.Init
This.Folder = &quot;InBox&quot;
Endproc

Thank you
Marius
 
machele

Two possibilities.
1. Did you register the OCX?
2. This.Folder = &quot;INBOX&quot; && Capitals?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I don't know how can i register the ocx
Thank you
 
Hi machele,

To keep this thread from growing out of control, questions not directly related can be started as separate threads. In this case.. &quot;How to register OCX&quot; as a thread.

However, the answer is.. in the Windows OS..
Click START->RUN command -> and in the box.. type..
REGSVR32 directory\path\myOCX.dll
Include the full path suitably.

:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Hy
Have a OutLook 6.00 on Win98. Now I've registered that DLL.
I have a question: Is there a diference betwen the way that Outlook from IE 6.0 manages it's e-mails (e.g. those .dbx files) and Outlook delivered with OfficeXP?
Why I ask you this ? Because of this:

OLE error code 0x80070005: Acces is denied

Regards

As I go deeper the road seems to go further. We're just simply pasangers on the road of knowledge.
 
ShyFox

No, the code suggested by Ramani works on my station (Windows XP, Outlook XP).

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,
If it isn't too much can you tell me if the file extension of you Outlook is .dbx or not? And where are this files situated?
Regards

As I go deeper the road seems to go further. We're just simply pasangers on the road of knowledge.
 
Shyfox

The .dbx extensions are used by Outlook Express:
C:\Documents and Settings\UserName\Application Data\Identities\{01F94700-C0AF-11D3-9FBB-E459BE2B7B6D}\Microsoft\Outlook Express

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
ShyFox,

The error is coming because the Outlook OLE control,
&quot;OVCtl.OVCtl.1&quot; is not installed or not available or some problem associated with it, in your computer. :)


ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top