Retrieve Outlook logged-in user SMTP address after connecting through OLE

后端 未结 2 823
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 05:12

Exchange Web Services has a ResolveNames() function that I can use to retrieve (among other things) the primary SMTP address for the Active Directory user that logged on to

2条回答
  •  忘掉有多难
    2020-12-07 05:53

    I found it. I have to go through the Accounts object in the namespace:

    for i := 1 to lNameSpace.Accounts.Count do
       if lNameSpace.Accounts.Item[i].AccountType = olExchange then
       begin
          lAccount := lNameSpace.Accounts.Item[i];
          Break;
       end;
    if VarIsClear(lAccount) then
    begin
       DisConnectFromOutlook;
       Exit;
    end;
    lLoginSMTP := lAccount.SmtpAddress;
    

    The only thing I would still like is to determine the default account.

提交回复
热议问题