Function Reference

_OL_ViewFieldAdd

Adds/inserts fields to/into a view and sets the formatting.

#Include <OutlookEX_GUI.au3>
_OL_ViewFieldAdd($oOL, $vView, $vFolder = Default, $aFields)

 

Parameters

$oOL Outlook object returned by a preceding call to _OL_Open()
$vView Index, name or object of the view to be modified
$vFolder Folder object as returned by _OL_FolderAccess or full name of folder. Has to be specified when $vView is not a view object
$aFields two dimensional zero-based array describing the ViewFields to be added/inserted with the following columns:
0 - Name of the property (field name: displayed in the Field Chooser) to be added/inserted
1 - One-based index number where to insert the property. If empty or 0 the property will be added after the last property
2 - Align: Alignment of the ViewField column. Can be any of the OlAlign enumeration
3 - FieldFormat: Display format of the property depending on the FieldType. For details please see Remarks
4 - Label: Column label and tooltip displayed for the property
5 - Width: Approximate width (in characters) of the column
$bReset [optional] Removes all existing ViewFields from the View before adding the new ViewFields (default = False)

 

Return Value

Success: Object of the view
Failure: Returns 0 and sets @error:
    1 - $vFolder has not been specified
    2 - Error accessing the specified folder. See @extended for errorcode returned by GetFolderFromID
    3 - Error accessing the folders views. @extended is set to the COM error code
    4 - View does not exist or an error occurred. @extended is set to the COM error code (if any)
    5 - Error adding/inserting a ViewField. @extended is set to the zero-based index of the ViewField in error
    6 - Error setting the Align ColumnFormat parameter for the specified ViewField. @extended is set to the zero-based index of the ViewField in error
    7 - Error setting the FieldFormat ColumnFormat parameter for the specified ViewField. @extended is set to the zero-based index of the ViewField in error
    8 - Error setting the Label ColumnFormat parameter for the specified ViewField. @extended is set to the zero-based index of the ViewField in error
    9 - Error setting the Width ColumnFormat parameter for the specified ViewField. @extended is set to the zero-based index of the ViewField in error
    10 - Error saving the new view. @extended is set to the COM error code
    11 - Invalid ViewType. Fields can only be added to CardViews and TableViews

 

Remarks

FieldFormat: https://docs.microsoft.com/en-us/office/vba/api/outlook.columnformat.fieldformat

 

Related