我不是开发人员,我试图了解为什么我的IT票务软件无法从Windows AD导入人员。一个月前还可以。我无法访问Windows AD,但是他们说“最近没有进行更改或升级”
我有一个孤立的问题与AD“经理”字段有关,这意味着我的票务软件可以选择不尝试导入经理字段(或其他任何字段),并且可以正常工作
这是执行导入的代码
Option Explicit On ' Change to Off instead of On to disable the need to declare variables with Dim. (NOT recommended)
Option Strict Off ' Change to Off instead of On to cast variables automatically. (NOT recommended)
Option Compare Binary ' Change to Text instead of Binary to let string "A" equal to "a".
Imports System
Imports System.Data
Imports System.Collections
这是转换脚本类。请注意以下规则:
' - You are not allowed to change the name of the class (must be "TransformationScript")
' - You are not allowed to change the namespace the class is in (the class "TransformationScript" must not be in a namespace).
' - You are not allowed to change the name of the method (must be "Transform")
' - You are not allowed to change the parameters of the "Transform" method
' This method is called by the transformation logic. The dt parameter contains the data table with the data to transform.
' Any additional arguments are passed in the additionalArguments list.
Public Class TransformationScript
Public Sub Transform (ByVal dt As System.Data.DataTable, ByVal additionalArguments As SortedList)
For Each row As DataRow In dt.Rows
Dim strValue As String
If Not String.IsNullorEmpty(row.Item("manager").ToString)
strValue = row.Item("manager").ToString
Dim strArray() As String
Dim strManager As String
Dim strManagerDisplayName As String
将AD管理器对象拆分为“ OU”,并将结果拆分为数组
strArray = strValue.Split("OU")
获取包含经理姓名的字符串数组位置“ 0”
strManager = strArray(0)
清理Manager的显示,并删除“ CN =“和“ \”以及最后一个“,”
strManagerDisplayName = strManager.Replace("CN=","")
strManagerDisplayName = strManagerDisplayName.Replace("\","")
strManagerDisplayName = strManagerDisplayName.Remove(strManagerDisplayName.Length-1)
返回经理显示名称
row.Item("manager") = strManagerDisplayName
End If
Next
End Sub
End Class
我想了解代码正在尝试做什么以及可能导致问题的根本原因
预先感谢