Lock email selection list

Add-in Express™ Support Service
That's what is more important than anything else

Lock email selection list
email lists  
Spiros Nikolopoulos


Guest


Hi,

I'm running an archiving procedure for a group of sel ected mails.
The selection list needs to be locked during the archiving procedure (which may take a lot time depending on the amount of selected mails).
Is it possible to lock the email selection list (or lock all the outlook application) and prevent user fr om using this list and modifying selection set?

Thanks
Posted 09 Jul, 2012 08:38:01 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Spiros,

How do you create such a list? Or maybe, you talk about items selected in the Outlook Explorer window? If the latter than I assume you cannot modify the selection until the archiving procedure is completed; this is because the procedure is run in the main thread.

Do I understand you right?


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jul, 2012 10:52:50 Top
Spiros Nikolopoulos


Guest


I'm getting Selection list from "SelectedItems" of


class function OutlookUtils.GetExplorerSelectionItem(AExplorer: Explorer;var SelectedItems:SelectedItemsType): IDispatch;
var
  sel: Selection;
  i  : Integer;

begin
  result := nil;
  sel := AExplorer.Selection;
  try
    if (sel.Count > 0) then begin
      result := sel.Item(1);

      setlength(SelectedItems,sel.Count);
      for i := 0 to sel.Count-1 do
        selectedItems[i] := sel.item(i+1);

    end;
  finally
    sel := nil;
  end;
end;


but during the archiving procedure which goes like :


for mlNo := 0 to length(SelectedItems) - 1 do //selected mails loop
 Begin

   ...archive message   MailItem(SelectedItems[mlNo]) ...
 End; 


I can click in outlook explorer window and modify selection.
Posted 09 Jul, 2012 11:03:36 Top
Spiros Nikolopoulos


Guest


OK I found it!
it was an Application.ProcessMessages inside the loop ...
Posted 10 Jul, 2012 03:09:47 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Oh, I see.

There was another way: you could store selected items to an array and process that array.


Andrei Smolin
Add-in Express Team Leader
Posted 10 Jul, 2012 03:30:43 Top