CheckName Method
CheckName Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Attempts to resolve an addressee directory object using the information specified in the object.
Applies To
Type Library
Microsoft CDO for Exchange 2000 Library
DLL Implemented In
CDOEX.DLL
Syntax
[Visual Basic]Sub CheckName
(
Directory As String,
[Username As String],
[Password As String]
) As Boolean
[C++]HRESULT CheckName ( BSTR Directory, BSTR Username, BSTR Password, VARIANT_BOOL* pVal );
Parameters
- Directory
The File URL or LDAPURL to use when performing the search. The File URL is used to search the Exchange store; the LDAPURL is used to search Active Directory.- Username
Optional user name authentication.- Password
Optional password authentication.- pVal
Indicates whether the check was successful.
Return Value
Returns S_OK if successful, or an error value otherwise.
Example
<Job id="resolveaddressee">
<reference object="cdo.message"/> <reference object="adodb.connection"/>
<script language="VBScript">
Dim iPer Set iPer = getCurrentPersonObject_ro
Wscript.Echo "User E-Mail Address:" wscript.echo iPer.Email
WScript.Echo "User Mailbox folder URL: " Wscript.Echo iPer.GetInterface("IMailbox").BaseFolder
Function getCurrentPersonObject_ro()
Dim Info Set Info = CreateObject("ADSystemInfo") Dim InfoNT Set InfoNT = CreateObject("WinNTSystemInfo") Dim iPer Set iPer = CreateObject("CDO.Person") Dim iAddr Dim iAddr2 Set iAddr = CreateObject("CDO.Addressee")
iAddr.EmailAddress = LCase(InfoNT.UserName) & "@" & Info.DomainDNSName
' Search by binding to an LDAP server in current domain. If Not iAddr.CheckName("LDAP://" & Info.DomainDNSName) Then ' Handle Ambiguous names here For Each iAddr2 in iAddr.AmbiguousNames wscript.echo iAddr2.DisplayName wscript.echo iAddr2.EmailAddress Next Else
' Note that this is for illustration purposes only as ' We already have the server-less LDAP URL to the current user: ' "LDAP://" & Info.UserName ' Or, ' "LDAP://" & Info.DomainDNSName & "/" & Info.UserName
Wscript.Echo "LDAP://" & Info.DomainDNSName & "/" & Info.UserName Wscript.Echo iAddr.DirURL
iPer.DataSource.Open iAddr.DirURL End If
Set getCurrentPersonObject_ro = iPer
End Function </script> </Job>
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.