| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
This property specifies a list of recipients and groups to accept or reject.
[Visual Basic,VBScript] Public Property RestrictedAddressList as Variant [C++] HRESULT get_RestrictedAddressList(VARIANT* Val)); HRESULT put_RestrictedAddressList(VARIANT Val)); [IDL] HRESULT [propget] RestrictedAddressList([out,retval] VARIANT* Val)); HRESULT [propput] RestrictedAddressList([in] VARIANT Val));
The default value for this property is NULL (no addresses defined).
This property is stored, encoded, in the protocol-settings multi-valued string attribute of the mail-recipient class.
If an email address is not found as belonging to a recipient in the Active Directory, the value is invalid. Thus this property is useful only for restricting or accepting addresses which can be resolved in the Active Directory.
This property accepts both email addresses and Windows Active Directory paths, yet in either case the addresses are converted to Active Directory paths. See Email Addresses Stored as Active Directory Paths for more information.
Sub RestrictAddresses(DomainName As String, _
FolderName As String)
'DomainName is something like "MyDomain.wherever.com"
'FolderName is something like "Public Folders/Folder3"
Dim objFolder As New CDO.Folder
Dim objMailRecip As CDOEXM.IMailRecipient
Dim fullurl As String
Dim i
'fullurl might look like:
' "file://./backofficestorage/MyDomain.wherever.com/Public Folders/Folder3"
fullurl = "file://./backofficestorage/" + _
DomainName + "/" + FolderName
objFolder.DataSource.Open fullurl, , adModeReadWrite, adFailIfNotExists
Set objMailRecip = objFolder
' can build an accept or reject list
objMailRecip.restrictedAddresses = cdoReject 'reject these emails
Dim list(3) As Variant
list(0) = "user@" + DomainName
list(1) = "user1@" + DomainName
list(2) = "user2@" + DomainName
objMailRecip.RestrictedAddressList = list
objFolder.DataSource.Save
'look at the results
Debug.Print Chr(13) + Chr(13) + "View list"
For i = LBound(objMailRecip.RestrictedAddressList) To UBound(objMailRecip.RestrictedAddressList)
Debug.Print objMailRecip.RestrictedAddressList(i)
Next
MsgBox "Mailbox restrictions for " + FolderName + " set successfully"
End Sub