![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi All,
I am developing add-in for Outlook 2003 (for Exchange Server 2003) using VSTO/C# 2005. As I found during my research on Outlook object model, it doesn't expose active directory security groups for the current user. To determine whether current user belongs to a specific active directory security group or not, I am executing LDAP query to get all security groups belonging to the user. Can you pls. point me the property/method to get exchange server address where I can fire this LDAP query? It'll be great if you can suggest another way to get security groups for the current user. Thanks, Piyush. |
#2
|
|||
|
|||
![]()
Here is what I use to get the Exchange server name given a user name
(Delphi). Note that most likely than not the AD server name will be different from that of the Exchange server. function HrGetExchangeServerName(UserName : string):string; var strCurrUserName, strCurrDomainName : string; ADSIUser : IADsUser; ADsNameTranslate : IADsNameTranslate; DN : string; Flags : integer; res : HResult; p : integer; begin p:=Pos('\', UserName); if p 0 then begin strCurrUserName:=Copy(UserName, p+1, MaxInt); strCurrDomainName:=Copy(UserName, 1, p-1); end else begin if not HrGetUserNameAndDomain(strCurrUserName, strCurrDomainName) then raise EOleSysError.Create('Culd not retrieve current user''s network name and domain', E_UNEXPECTED, 0); end; ADsNameTranslate:=CreateOleObject('NameTranslate') as IADsNameTranslate; //DNL ADsNameTranslate.Init(ADS_NAME_INITTYPE_DOMAIN, strCurrDomainName); if Pos('\', UserName) 0 then Flags:=ADS_NAME_TYPE_NT4 else if Pos('@', UserName) 0 then Flags:=ADS_NAME_TYPE_DOMAIN_SIMPLE else Flags:=ADS_NAME_TYPE_UNKNOWN; ADsNameTranslate.Set_(Flags, UserName); DN:=ADsNameTranslate.Get(ADS_NAME_TYPE_1779); //find the LDAP object from the AD res:=ADsGetObject(PWideChar(WideString('LDAP://' + strCurrDomainName + '/' + DN)), IID_IADsUser, pointer(ADSIUser)); CheckRaiseMAPIError(res, 'ADsGetObject'); ADSIUser.GetInfoEx(VarArrayOf(['msExchHomeServerName']), 0); Result:=ADSIUser.Get('msExchHomeServerName'); p:=PosFromEnd('=', Result); if p 0 then Result:=Copy(Result, p+1, MaxInt); end; Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Piyush Gupta" wrote in message oups.com... Hi All, I am developing add-in for Outlook 2003 (for Exchange Server 2003) using VSTO/C# 2005. As I found during my research on Outlook object model, it doesn't expose active directory security groups for the current user. To determine whether current user belongs to a specific active directory security group or not, I am executing LDAP query to get all security groups belonging to the user. Can you pls. point me the property/method to get exchange server address where I can fire this LDAP query? It'll be great if you can suggest another way to get security groups for the current user. Thanks, Piyush. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recipient.Address in Exchange Server | Joel | Outlook and VBA | 3 | December 8th 06 04:52 AM |
Update address book automatically FROM EXCHANGE SERVER | gchandrujs via OfficeKB.com | Outlook - Using Contacts | 2 | November 10th 06 02:50 AM |
Importing External Email Address To Exchange Server | Lisa AGA | Outlook - Using Contacts | 1 | October 23rd 06 11:00 PM |
Cannot connect to Exchange server from Outlook client on Windows 2003 Server | AllenM | Outlook - General Queries | 0 | May 16th 06 06:44 PM |
!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine | AllenM | Outlook - General Queries | 0 | May 11th 06 10:14 PM |