Link to home
Start Free TrialLog in
Avatar of LoyolaTS
LoyolaTS

asked on

Unable to use ILM to set the MSExchHideFromAddressLists attribute in AD

When I disable a user in ILM 2007, I would like to hide them in the Exchange 2007 address book.  I currently have this piece of code in my AD MA:

csentry("MSExchHideFromAddressLists").BooleanValue = True

When I run a sync, I get the following error message:

System.InvalidOperationException: attribute msExchHideFromAddressLists is read-only
   at Microsoft.MetadirectoryServices.Impl.AttributeImpl.set_BooleanValue(Boolean value)
   at Mms_ManagementAgent_ActiveDirectoryMA.MAExtensionObject.MapAttributesForExport(String FlowRuleName, MVEntry mventry, CSEntry csentry) in

What am I doing wrong?
Avatar of ZJORZ
ZJORZ
Flag of Netherlands image

you can only use that (csentry("MSExchHideFromAddressLists").BooleanValue = True) during outbound attribute flow (from MV to CS)
 
can you post the complete section where that piece is used?
Avatar of LoyolaTS
LoyolaTS

ASKER

This code is part of my ActiveDirectoryMA.dll which is a rules extension of my AD management agent.  What I'm trying to do is remove employees from the address book at the same time they are being disabled.

Case "StatusFlagDisable"
                Dim strloyRoles As String

                If mventry("loyRoles").IsPresent Then
                    strloyRoles = mventry("loyRoles").Value.ToLower
                Else
                    strloyRoles = ""
                End If

                If (mventry("loyIsAlumni").IsPresent AndAlso mventry("loyIsEmployee").IsPresent AndAlso mventry("loyIsFaculty").IsPresent AndAlso mventry("loyIsGradStu").IsPresent AndAlso mventry("loyIsNonLoyolaStu").IsPresent AndAlso mventry("loyIsStuWithdrawn").IsPresent AndAlso mventry("loyIsUnGradStu").IsPresent) Then
                    If (mventry("loyIsNonEmp").IsPresent AndAlso (mventry("loyIsNonEmp").Value.ToUpper = "NEL" Or mventry("loyIsNonEmp").Value.ToUpper = "NER" Or mventry("loyIsNonEmp").Value.ToUpper = "NED" Or mventry("loyIsNonEmp").Value.ToUpper = "NEB" Or mventry("loyIsNonEmp").Value.ToUpper = "NEJ" Or mventry("loyIsNonEmp").Value.ToUpper = "NET" Or mventry("loyIsNonEmp").Value.ToUpper = "NES" Or mventry("loyIsNonEmp").Value.ToUpper = "NEG" Or mventry("loyIsNonEmp").Value.ToUpper = "NEC")) Then
                        'Do nothing because user is NEMP (non-employee)
                        'Enable/Disable account is done manually
                    ElseIf strloyRoles.Contains("serviceacct") Then
                        'Do nothing because the account is a service account
                    Else
                        'If all flags inactive and user is not emeritus, disable
                        If (mventry("loyIsAlumni").Value.ToLower = "n" AndAlso mventry("loyIsEmployee").Value.ToLower = "n" AndAlso mventry("loyIsFaculty").Value.ToLower = "n" AndAlso mventry("loyIsGradStu").Value.ToLower = "n" AndAlso mventry("loyIsNonLoyolaStu").Value.ToLower = "n" AndAlso mventry("loyIsStuWithdrawn").Value.ToLower = "n" AndAlso mventry("loyIsUnGradStu").Value.ToLower = "n") Then
                            If (mventry("loyJobClass").IsPresent AndAlso mventry("loyJobClass").Value = "13") Then
                                csentry("userAccountControl").IntegerValue = NORMAL_ACCOUNT
                            Else
                                csentry("userAccountControl").IntegerValue = ACCOUNTDISABLE
                                csentry("MSExchHideFromAddressLists").BooleanValue = True
                            End If
                            'If any flag active, enable
                            If (mventry("loyIsAlumni").Value.ToLower = "y" Or mventry("loyIsEmployee").Value.ToLower = "y" Or mventry("loyIsFaculty").Value.ToLower = "y" Or mventry("loyIsGradStu").Value.ToLower = "y" Or mventry("loyIsNonLoyolaStu").Value.ToLower = "y" Or mventry("loyIsStuWithdrawn").Value.ToLower = "y" Or mventry("loyIsUnGradStu").Value.ToLower = "y") Then
                                csentry("userAccountControl").IntegerValue = NORMAL_ACCOUNT
                                csentry("MSExchHideFromAddressLists").BooleanValue = False
                            End If
                        End If
                    End If
                End If
ASKER CERTIFIED SOLUTION
Avatar of LoyolaTS
LoyolaTS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial