Problem Assigning Task Items in Outlook

Giganews Newsgroups
Subject: Problem Assigning Task Items in Outlook
Posted by:  Eddie Shipman (mr_delphi_develop…
Date: Tue, 21 Jul 2009

// ConnectToOutlook creates the Outlook COM Object
// named pmOutlook
bCloseMe := ConnectToOutlook(pmOutlook);

// We have Ad-In Express Security Manager to disable
// warnings from Outlook
pmSecMgr.ConnectTo( pmOutlook );
pmSecMgr.DisableOOMWarnings := TRUE;

  // Here we create the Task Item
  TaskItem        := pmOutlook.CreateItem( olTaskItem );
  // And set some of it's properties
  TaskItem.Subject := pmDM.qryPMTasksCAPTION.AsString;
  TaskItem.DueDate := pmDM.qryPMTasksDueDate.AsDateTime;
  // And more of it's properties are set here

  // Now, when assigning the item, The TLB AND Outlook2000.pas
  // say to use Assign_
  // But I get a "not supported" error when doing so.
  // The call to Assign seems to work
  TaskItem  := TaskItem.Assign;

  // slUserAddrs is a stringlist with smtp addresses of
  // the users that are to get the Task sent to them.
  for i := 0 to slUserAddrs.Count -1 do
    Recipient := TaskItem.Recipients.Add('"'+slUserAddrs[i]+'"');
    // NONE of the adresses resolve even though I can send email
    // to them using the same smtp address in the list
    if not Recipient.Resolve then
      ShowMessage('check name:' + '"'+slUserAddrs[i]+'"');
  Recipient := Unassigned;
  // This will unassign all COM objects.
  UnassignOLItems(pmOutlook, VarNull, VarNull, VarNull,
                  TaskItem, bCloseMe);