Consultor Eletrônico



Kbase P123609: How to change the Microsoft Office Outlook View Control using 4GL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/02/2009
Status: Verified

GOAL:

How to change the Microsoft Office Outlook View Control using 4GL?

GOAL:

How to use the Microsoft Office Outlook View Control in a Progress Window?

GOAL:

How to embed the Microsoft Office Outlook View Control in a Progress GUI Application?

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

FIX:

Following is a step by step procedure that demonstrates how to embed the Microsoft Office Outlook View Control in a Progress GUI Application and how to change the folder type view of the control. Notice that the success of the folder type view change assumes that: (A) An instance of Outlook is running and (B) the recipient name passed to the OpenSharedDefaultFolder method is valid and (C) the recipient has the proper permissions to open the desired view. If any of these conditions is not satisfied then only the Inbox view is available:
1. Start the AppBuilder.
Start -> Programs -> Progress -> AppBuilder.
2. Create a new Window.
File -> New -> Window
3. Drop a COMBO-BOX widget on the Window and name it FolderViewSelector.
4. Mouse Click the OCX button on the Object Palette and mouse double click the Microsoft Office Outlook View Control from the choose Control dialog.
5. Move the mouse over the application window and mouse click to drop the control over the window.
6. Position and size both the Window and Control to taste.
7. In the definition section, cut and paste the following Microsoft Office Outlook View Control folder type constants:
/* Microsoft Office Outlook View Control folder type constants */
&GLOBAL-DEFINE olFolderDeletedItems 3
&GLOBAL-DEFINE olFolderOutbox 4
&GLOBAL-DEFINE olFolderSentMail 5
&GLOBAL-DEFINE olFolderInbox 6
&GLOBAL-DEFINE olFolderCalendar 9
&GLOBAL-DEFINE olFolderContacts 10
&GLOBAL-DEFINE olFolderJournal 11
&GLOBAL-DEFINE olFolderNotes 12
&GLOBAL-DEFINE olFolderTasks 13
&GLOBAL-DEFINE olFolderDrafts 16
8. In the Main Block insert the statement:
RUN PopulateComboBox.
after the statement:
RUN enable_UI.

9. Create the following internal procedure to populate the folder view selector combo-box:
PROCEDURE PopulateComboBox :
DEFINE VARIABLE cDelimiter AS CHARACTER NO-UNDO.
ASSIGN
cDelimiter = ","
FolderViewSelector:LIST-ITEMS IN FRAME {&FRAME-NAME}=
"Deleted Items" + cDelimiter +
"Outbox" + cDelimiter +
"SentMail" + cDelimiter +
"Inbox" + cDelimiter +
"Calendar" + cDelimiter +
"Contacts" + cDelimiter +
"Journal" + cDelimiter +
"Notes" + cDelimiter +
"Tasks" + cDelimiter +
"Drafts"
FolderViewSelector:SCREEN-VALUE IN FRAME {&FRAME-NAME}= ENTRY(4,FolderViewSelector:LIST-ITEMS IN FRAME {&FRAME-NAME}).
END PROCEDURE.

10. Create the following VALUE-CHANGED trigger for the folder view selector combo-box:
ON VALUE-CHANGED OF FolderViewSelector IN FRAME DEFAULT-FRAME /* Folder View Selector */
DO:
DEFINE VARIABLE iFolderType AS INTEGER NO-UNDO.
DEFINE VARIABLE cRecipient AS CHARACTER NO-UNDO.
DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.

ASSIGN
cRecipient = "yshanshi". /* An Outlook Recipient authorized to view the requested folder */
CASE FolderViewSelector:SCREEN-VALUE IN FRAME {&FRAME-NAME}:
WHEN "Deleted Items" THEN
&nbs.p; lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderDeletedItems}) NO-ERROR. /* 3 */
WHEN "Outbox" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderOutbox}) NO-ERROR. /* 4 */
WHEN "SentMail" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderSentMail}) NO-ERROR. /* 5 */
WHEN "Inbox" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderInbox}) NO-ERROR. /* 6 */
WHEN "Calendar" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderCalendar}) NO-ERROR. /* 9 */
WHEN "Contacts" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderContacts}) NO-ERROR. /* 10 */
WHEN "Journal" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderJournal}) NO-ERROR. /* 11 */
WHEN "Notes" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderNotes}) NO-ERROR. /* 12 */
WHEN "Tasks" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderTasks}) NO-ERROR. /* 13 */
WHEN "Drafts" THEN
lResult = chCtrlFrame:ViewCtl:OpenSharedDefaultFolder(cRecipient,{&olFolderDrafts}) NO-ERROR. /* 16 */
END CASE.
END.
11. Save the Window.
12. Run the Window..