Copyright © 2024 IMIBO. Privacy Statement
Extended MAPI in DELPHI
Experimental # 3
MAPI help functions checker
Internal application for testing helper functions like GetPropString, IsExchangeStore, GetSentBox, GetPropBoolean, GetDefaultFolder, etc.
procedure TfrmTestMHF.CheckFunctions; var iContentCount, iCount: Integer; fMsg: IMessage; begin iContentCount := 0; fMsg := nil; // Get Store Name (check also function GetPropString) ListBox.Items.Add('MsgStore Name: ' + GetPropString(fMsgStore, PR_DISPLAY_NAME)); // Check for Exchange Store ListBox.Items.Add('Is Exchange Store: ' + BooltoStr(IsExchangeStore(fMsgStore), True)); // Get SentBox fMsgFolder := GetSentBox(fMsgStore); // Get SentBox Comment - PR_COMMENT if FPropExists(fMsgFolder, CHANGE_PROP_TYPE(PR_COMMENT, PT_UNSPECIFIED)) then ListBox.Items.Add('SentBox Description: ' + GetPropString(fMsgFolder, PR_COMMENT)) else ListBox.Items.Add('SentBox Description does not exists'); // Get SentBox Items Count (check also function GetPropLong) if FPropExists(fMsgFolder, PR_CONTENT_COUNT) then begin iContentCount := GetPropLong(fMsgFolder, PR_CONTENT_COUNT); ListBox.Items.Add('Sent Items Count: ' + IntToStr(iContentCount)); end; // Check SentBox for SubFolders (check also function GetPropBoolean) if FPropExists(fMsgFolder, PR_SUBFOLDERS) then ListBox.Items.Add('Sent Items Subfolders: ' + BooltoStr(GetPropBoolean(fMsgFolder, PR_SUBFOLDERS), True)); if iContentCount > 0 then begin ListBox.Items.Add('-= Messages =-'); for iCount := 0 to iContentCount - 1 do begin ListBox.Items.Add('-! Message ID #' + IntToStr(iCount) + ' !-'); // Get Message fMsg := GetMapiMessage(fMsgFolder, iCount); // Get Msg Recipient if FPropExists(fMsg, CHANGE_PROP_TYPE(PR_DISPLAY_TO, PT_UNSPECIFIED)) then ListBox.Items.Add('Message Recipient: ' + GetPropString(fMsg, PR_DISPLAY_TO)); // Get Msg Subject if FPropExists(fMsg, CHANGE_PROP_TYPE(PR_SUBJECT, PT_UNSPECIFIED)) then ListBox.Items.Add('Message Subject: ' + GetPropString(fMsg, PR_SUBJECT)); // Get Sent DateTime if FPropExists(fMsg, PR_CLIENT_SUBMIT_TIME) then ListBox.Items.Add('Message Sent DateTime: ' + DateTimeToStr(GetPropSysTime(fMsg, PR_CLIENT_SUBMIT_TIME))); fMsg := nil; ListBox.TopIndex := ListBox.Items.Count - 1; Application.ProcessMessages; end; ListBox.Items.Add('-= Messages End =-') end; // Get Contacts Folder fMsgFolder := GetDefaultFolder(fMsgStore, oFolderContacts); // Get Contacts Name ListBox.Items.Add('Contacts folder Name: ' + GetPropString(fMsgFolder, PR_DISPLAY_NAME)); // Get Contacts Comment - PR_COMMENT if FPropExists(fMsgFolder, CHANGE_PROP_TYPE(PR_COMMENT, PT_UNSPECIFIED)) then ListBox.Items.Add('Contacts Description: ' + GetPropString(fMsgFolder, PR_COMMENT)) else ListBox.Items.Add('Contacts Description does not exists'); iContentCount := 0; // Get Contacts Items Count (check also function GetPropLong) if FPropExists(fMsgFolder, PR_CONTENT_COUNT) then begin iContentCount := GetPropLong(fMsgFolder, PR_CONTENT_COUNT); ListBox.Items.Add('Contacts Count: ' + IntToStr(iContentCount)); end; ListBox.TopIndex := ListBox.Items.Count - 1; if iContentCount > 0 then begin ListBox.Items.Add('-= Contacts =-'); for iCount := 0 to iContentCount - 1 do begin ListBox.Items.Add('-! Contact ID #' + IntToStr(iCount) + ' !-'); // Get Contact fMsg := GetMapiMessage(fMsgFolder, iCount); // Get Contact Display Name if FPropExists(fMsg, CHANGE_PROP_TYPE(PR_DISPLAY_NAME, PT_UNSPECIFIED)) then ListBox.Items.Add('Display As: ' + GetPropString(fMsg, PR_DISPLAY_NAME)); // Get E-mail Address if FPropExists(fMsg, CHANGE_PROP_TYPE(PR_EMAIL_ADDRESS, PT_UNSPECIFIED)) then ListBox.Items.Add('E-mail: ' + GetPropString(fMsg, PR_EMAIL_ADDRESS)); // Get Message Class if FPropExists(fMsg, CHANGE_PROP_TYPE(PR_MESSAGE_CLASS, PT_UNSPECIFIED)) then ListBox.Items.Add('Class: ' + GetPropString(fMsg, PR_MESSAGE_CLASS)); fMsg := nil; ListBox.TopIndex := ListBox.Items.Count - 1; Application.ProcessMessages; end; ListBox.Items.Add('-= Contacts End =-') end; ListBox.Items.Add('-= Exchange Server Name =-'); ListBox.Items.Add(GetExchangeServerName(fMAPISession)); end;