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

OUTLOOK: Modifying View Columns Programatically?? 1

Status
Not open for further replies.

Docpro777

Programmer
Joined
Jul 1, 2003
Messages
105
Location
US
I am trying to modify columns in say a table view of appointments, programtically. Manually, one does this by simply accessing 'define view' under Outlook's View Menu.

Consider the basic COM code:

oOutlook = Createobject("Outlook.Application")
objViews = oOutlook.getnamespace("MAPI").GetDefaultFolder(9).Views &&Calendar format
objView = objViews.ADD('MyNewTableCalendarView',0,0)
objView.apply

Voila! ... a new Calendar view in a table format is created in the same (customizeable) format as "Active Appointments" and listed under the 'Current Views' Submenu.

Would any of you OUTLOOK enthusiasts perhaps know of a viable way to CUSTOMIZE VIEW(s) programatically (SANS XML scripting)?

Thanks in advance for any thought.

Philip M. Traynor, DPM
 
DocPro777

oOutlook = Createobject("Outlook.Application")
objViews = oOutlook.getnamespace("MAPI").GetDefaultFolder(9).Views &&Calendar format
objView = objViews.ADD('MyNewTableCalendarView',0,0)
objView.apply


I get an error with your code at:

objView = objViews.ADD('MyNewTableCalendarView',0,0)

The error seems to be a wrong parameter. (VFP8.0, Outlook 2002, WinXP)


Mike Gagnon

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

May I ask why you do not want to use the XML parser to modify your view? It seems like a viable solution.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, to answer both of your questions:

1) The parameter error only occurs for me after the custom view is created (you can see your new custom view under the 'Current Views' Submenu of 'View' in Outlook). Note:
--the Enum: 0 for olTableView
--TRY-CATCH-ENDTRY: Outlook throws an exception into CATCH sometimes: i.e., when it's not visible and VFP's Outlook class is running:

#DEFINE olTableView 0
TRY
oOutlook = Createobject("Outlook.Application")
objViews = oOutlook.getnamespace("MAPI").GetDefaultFolder(9).Views &&Calendar format
objView = objViews.ADD('MyNewTableCalendarView',0,0)
objView.apply
CATCH
ENDTRY

2) I have studied the XML parser in MSDN Library's ( 'Creating Custom Views' Technical Article under Outlook 2002.
I am presently quite a bit lost when it comes to XML. But, I'll stab at it a few more times to try to get a viable solution.

Thanks again for your thoughtful and kind feedback. (Any other feedback is welcome)

Philip M. Traynor, DPM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top