Extended MAPI in DELPHI
LazyMAPI
Included Helper Classes & Objects
TMAPIPropFields – represents a collection of MAPI property values.
Delphi wrapper object for SPropValue array.
unit: MAPIPropFields.pas
file path: ..\Library\Helpers
version: 2018.хх
uses Classes, Windows, Types, SysUtils, Contnrs, ExtendedMAPI, MapiUtils, IMIEMTypes
| Unit: | MAPIPropFields.pas |
| Type: | Class |
| Inherited from: | TMAPIBase |
Declaration:
TMAPIPropFields = class(TMAPIBase)
private
...
protected
...
public
constructor Create(const oMAPIObject: IMAPIProp); overload;
constructor Create(cValues: ULONG; PropValues: PSPropValue); overload;
destructor Destroy; override;
property Count: ULONG read GetCount;
property Item[const Index: Integer]: TMAPIPropField Read GetItem; default;
property ItemOf[const PropTag: ULONG]: TMAPIPropField Read GetItemOf;
property ItemOfNamed[const NameID: Variant; const PropSetID: TGUID]: TMAPIPropField Read GetItemOfNamed;
property Tags: TCardinalDynArray read GetTags;
property Modified: Boolean read GetModified;
function PropExists(const PropTag: ULONG): Boolean; overload;
function PropExists(const NameID: Variant; const PropSetID: TGUID; out PropTag: ULONG): Boolean; overload;
function IndexOf(const PropTag: ULONG): Integer;
procedure Refresh;
procedure SaveChanges;
function AddNew(const PropTag: ULONG): TMAPIPropField; overload;
function AddNew(const NameID: Variant; const PropSetID: TGUID; const PropType: ULONG): TMAPIPropField; overload;
procedure Delete(const PropTag: ULONG);
end;
Constructors
| Name | Description |
| Create(const oMAPIObject: IMAPIProp) | Creates and initializes object instance from IMAPIProp |
| Create(cValues: ULONG; PropValues: PSPropValue) | Creates and initializes object instance from PSPropValue |
Properties
| Name | Access | Type | Description |
| Count | RO | Integer | The Count property returns the total number of MAPI Properties. |
| Item | RO | TMAPIPropField | Represent a single MAPI Property. |
| ItemOf | RO | TMAPIPropField | Represent a single MAPI Property accessed by PropTag |
| ItemOfNamed | RO | TMAPIPropField | Represent a single MAPI NAMED Property accessed by NameID and PropSetID |
| Tags | RO | TCardinalDynArray | Returns an array (PropTags) of existing MAPI Properties inside IMAPIProp object or PSPropValue |
| Modified | RO | Boolean | Indicates whether the object is changed |
Methods
| Name | Description |
| PropExists | Returns TRUE if property specified by PropTag exists. |
| PropExists | Returns TRUE if property specified as named property (PropNamed) exists. |
| IndexOf | Returns the index of the TMAPIPropField object with a specified PropTag. |
| Refresh | Clear internal cache. |
| Delete | Delete a single MAPI property with a specified PropTag from object. |
| AddNew | Add a new property with a specified PropTag. |
| AddNew | Add a new named property with a specified MAPINAMEID structure. |
| SaveChanges | Makes permanent any changes that were made. |
usage:
procedure TRecurrencePatternExceptionDlg.btPropertiClick(Sender: TObject);
var
PropFields: TMAPIPropFields;
begin
if not Assigned(FExceptionMessage) then
ShowMessage('There is no selected object!')
else
begin
PropFields := TMAPIPropFields.Create(FExceptionMessage.MAPIObject);
try
with TFrmMAPIPropFields.Create(Self) do
begin
try
SetPropFields(PropFields);
ShowModal;
finally
Free;
end;
end;
finally
FreeAndNil(PropFields);
end;
end;
end;
