LazyMAPI

MAPIVariantProp

unit: MAPIVariantProp.pas
file path: ..\Library\
version: 2014.хх
uses ExtendedMAPI

Available functions:

function ConvertMAPIPropValueToVariant - Converts TSPropValue Value member to Variant


function ConvertVariantToMAPIPropValue - Converts Variant to TSPropValue

procedure ClearVarPropValue - Frees memory occupied by ConvertVariantToMAPIPropValue


function PT_SHORT2V - Converts SPropValue type PT_SHORT to Variant type varSmallint

function PT_LONG2V - Converts SPropValue type PT_LONG to Variant type varInteger

function PT_I82V - Converts SPropValue type PT_I8 (PT_LONGLONG) to Variant type varInt64

function PT_FLOAT2V - Converts SPropValue type PT_FLOAT (PT_R4) to Variant type varSingle

function PT_DOUBLE2V - Converts SPropValue type PT_DOUBLE (PT_R8) to Variant type varDouble

function PT_BOOLEAN2V - Converts SPropValue type PT_BOOLEAN to Variant type varBoolean

function PT_APPTIME2V - Converts SPropValue type PT_APPTIME to Variant type varDate

function PT_SYSTIME2V - Converts SPropValue type PT_SYSTIME to Variant type varDate

function PT_STRING82V - Converts SPropValue type PT_STRING8 to Variant type varOleStr

function PT_BINARY2V - Converts SPropValue type PT_BINARY to Variant type varArray of VarByte

function PT_UNICODE2V - Converts SPropValue type PT_UNICODE to Variant type varOleStr

function PT_CLSID2V - Converts SPropValue type PT_CLSID to Variant type varOleStr

function PT_CURRENCY2V - Converts SPropValue type PT_CURRENCY to Variant type varCurrency


function PT_MV_SHORT2V -  Converts SPropValue type PT_MV_SHORT to Variant type varArray of varSmallint

function PT_MV_LONG2V -  Converts SPropValue type PT_MV_LONG to Variant type varArray of varInteger

function PT_MV_FLOAT2V -  Converts SPropValue type PT_MV_FLOAT to Variant type varArray of varSingle

function PT_MV_DOUBLE2V -  Converts SPropValue type PT_MV_DOUBLE to Variant type varArray of varDouble

function PT_MV_CURRENCY2V -  Converts SPropValue type PT_MV_CURRENCY to Variant type varArray of varCurrency

function PT_MV_APPTIME2V - Converts SPropValue type PT_MV_APPTIME to Variant type varArray of varDate

function PT_MV_SYSTIME2V - Converts SPropValue type PT_MV_SYSTIME to Variant type varArray of varDate

function PT_MV_BINARY2V - Converts SPropValue type PT_MV_BINARY to Variant type varArray of varArray of varByte

function PT_MV_STRING82V - Converts SPropValue type PT_MV_STRING8 to Variant type varArray of varOleStr

function PT_MV_UNICODE2V -   Converts SPropValue type PT_MV_UNICODE to Variant type varArray of varOleStr

function PT_MV_CLSID2V - Converts SPropValue type PT_MV_CLSID to Variant type varArray of varOleStr

function PT_MV_I82V - Converts SPropValue type PT_MV_I8 to Variant type varArray of varInt64


function ConvertMAPIPropValueToVariant(Value: PSPropValue): Variant;

description: 
  Converts TSPropValue Value member to Variant

parameters:
  Value: PSPropValue - pointer to an existing TSPropValue whose value will be converted to Variant

note:
  ulproptag parts of TSPropValue must contain valid PropType

usage:

hr := MailBox.GetProps(nil, fMapiUnicode, cValues, UserPropValue);

if (not Failed(hr)) and (cValues > 0) and Assigned(UserPropValue) then
begin
  for iCount := 0 to cValues - 1 do
  try
    // Print out property tag and its value 
    Memo.Lines.Add(SzGetPropTag(PSPropValueArray(UserPropValue)[iCount].ulPropTag)  + ': ' +   ConvertMAPIPropValueToVariant(@PSPropValueArray(UserPropValue)[iCount]));
  except
   Memo.Lines.Add('Error!'); 
  end;
end;

Top


function ConvertVariantToMAPIPropValue(VariantValue: Variant; var PropValue: TSPropValue; Parent: Pointer = nil): boolean;

description: 
  Converts Variant to TSPropValue

usage:

// Set MAPI Message property
Procedure SaveValueField(const MAPIMessage:IMessage;  PropertyTag : Cardinal; Value : Variant);
var
 hr:HRESULT;
 Prop:TSPropValue;
begin
  Prop.ulPropTag := PropertyTag;
  ConvertVariantToMAPIPropValue( value, PropArray) ;
  try
     hr := MAPIMessage.SetProps(1, @Prop, PSPropProblemArray(nil^));
     if Failed(hr) then
       begin
          ErrorMessage(GetMAPIError(MAPIMessage, hr));
       exit;
   finally
     ClearVarPropValue(@Prop);
   end;
end;

Top


procedure ClearVarPropValue(PropValue: PSPropValue; Parent: Pointer = nil);

 

description: 
  Frees memory occupied by ConvertVariantToMAPIPropValue

Top


function PT_SHORT2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_SHORT to Variant type varSmallint

Top


function PT_LONG2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_LONG to Variant type varInteger

Top


function PT_I82V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_I8 (PT_LONGLONG) to Variant type varInt64

Top


function PT_FLOAT2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_FLOAT (PT_R4) to Variant type varSingle

Top


function PT_DOUBLE2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_DOUBLE (PT_R8) to Variant type varDouble

Top


function PT_BOOLEAN2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_BOOLEAN to Variant type varBoolean

Top


function PT_APPTIME2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_APPTIME to Variant type varDate

Top


function PT_SYSTIME2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_SYSTIME to Variant type varDate

Top


function PT_STRING82V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_STRING8 to Variant type varOleStr

Top


function PT_BINARY2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_BINARY to Variant type varArray of varByte

Top


function PT_UNICODE2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_UNICODE to Variant type varOleStr

Top


function PT_CLSID2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_CLSID to Variant type varOleStr

Top


function PT_CURRENCY2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_CURRENCY to Variant type varCurrency

Top


function PT_MV_SHORT2V(V: T__UPV): Variant;

 

description:
 Converts SPropValue type PT_MV_SHORT to Variant type varArray of varSmallint

Top


function PT_MV_LONG2V(V: T__UPV): Variant;

 

 

description:

  Converts SPropValue type PT_MV_LONG to Variant type varArray of varInteger

Top


function PT_MV_FLOAT2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_FLOAT to Variant type varArray of varSingle

Top


function PT_MV_DOUBLE2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_DOUBLE to Variant type varArray of varDouble

Top


function PT_MV_CURRENCY2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_CURRENCY to Variant type varArray of varCurrency

Top


function PT_MV_APPTIME2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_APPTIME to Variant type varArray of varDate

Top


function PT_MV_SYSTIME2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_SYSTIME to Variant type varArray of varDate

Top


function PT_MV_BINARY2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_BINARY to Variant type varArray of varArray of varByte

Top


function PT_MV_STRING82V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_STRING8 to Variant type varArray of varOleStr

Top


function PT_MV_UNICODE2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_UNICODE to Variant type varArray of varOleStr

Top


function PT_MV_CLSID2V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_CLSID to Variant type varArray of varOleStr

Top


function PT_MV_I82V(V: T__UPV): Variant;

 

description:

  Converts SPropValue type PT_MV_I8 to Variant type varArray of varInt64

Top


Copyright © 2021 IMIBO
Privacy Statement