Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

SSIS SCRIPT COMPONENT ERROR

$
0
0

I have a Code that extracts the Active Directory User information from various Domains. It works fine for the most part but then it keeps failing with output buffer error. If i remove one column then the pacakge runs fine. I have few columns i need to extract data from . Any suggestion or help to get the data from n-number of columns will be helpful

Here is the error i get

SSIS SCRIPT COMPONENT ERROR :  “The value is too large to fit in the column data area of the buffer”

I am assuming their should be some property to set that will extract the data .. I tried both String and integer , same issue.

Not sure if their is in limitation of number of columns i can extract

Imports System
Imports System.Data
Imports System.DirectoryServices    'You must Add This, Since I am not fully qualifying the Class names with the namespace.
Imports System.Math
Imports System.Text                 'namespace for the StringBuilder class
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _<CLSCompliant(False)> _
Public Class ScriptMain
    Inherits UserComponent
    Public Overrides Sub CreateNewOutputRows()
        Dim de As New DirectoryEntry
        Dim searcher As New DirectorySearcher
        Dim search_result As SearchResultCollection
        Dim result As SearchResult
        Dim props As ResultPropertyCollection
        Dim MemberOfList As StringBuilder
        Dim PropertiesList, s As String
        Using (de)
            de.Path = Me.ReadOnlyVariables("gLDAPQuery").Value.ToString()
            Using (searcher)
                searcher.SearchRoot = de
                searcher.Filter = Me.ReadOnlyVariables("gLDAPFilter").Value.ToString()
                searcher.SearchScope = SearchScope.Subtree
                ' List of ActiveDirectory columns to retrieve
                searcher.PropertiesToLoad.Add("SamAccountName")
                searcher.PropertiesToLoad.Add("EmployeeID")
                searcher.PropertiesToLoad.Add("GivenName")
                searcher.PropertiesToLoad.Add("Mail")
                searcher.PropertiesToLoad.Add("SN")
                searcher.PropertiesToLoad.Add("Description")
                searcher.PropertiesToLoad.Add("DN")
                searcher.PropertiesToLoad.Add("createTimeStamp")
                searcher.PropertiesToLoad.Add("homeMDB")
                searcher.PropertiesToLoad.Add("mDBStorageQuota")
                searcher.PropertiesToLoad.Add("mDBOverHardQuotaLimit")
                searcher.PropertiesToLoad.Add("mDBOverQuotaLimit")
                searcher.PropertiesToLoad.Add("mDBUseDefaults")
                searcher.PropertiesToLoad.Add("msRTCSIP-UserEnabled")
                searcher.PropertiesToLoad.Add("extensionAttribute9")
                searcher.PropertiesToLoad.Add("Pwdlastset")
                searcher.PropertiesToLoad.Add("useraccountcontrol")
                ' limited to some threshold.
                searcher.PageSize = 2048
                'Retrieve the results from Active Directory
                search_result = searcher.FindAll()
                For Each result In search_result
                    props = result.Properties
                    'Create a placeholder to store the list of applicable properties 
                    ' for a given Active Directory record.
                    PropertiesList = ""
                    For Each s In props.PropertyNames
                        PropertiesList = PropertiesList & s & ","
                    Next
                    'remove last comma
                    PropertiesList = PropertiesList.Substring(0 _
                                    , PropertiesList.Length() - 1)
                    ' Add rows by calling AddRow method on member variable called "<Output Name>Buffer"
                    ' E.g. in our case it will be ActiveDirectoryOutputBuffer
                    ActiveDirectoryOutputBuffer.AddRow()
                    ActiveDirectoryOutputBuffer.PropertiesList = PropertiesList
                    'Need to check wheter the props collection does contain the property before retrieving the values
                    '  because some Active Directory Records may or may not contain some properties.
                    If props.Contains("SamAccountName") = True Then
                        ActiveDirectoryOutputBuffer.SamAccountName = props("SamAccountName")(0).ToString()
                    End If
                    If props.Contains("Mail") = True Then
                        ActiveDirectoryOutputBuffer.Mail = props("Mail")(0).ToString()
                    End If
                    If props.Contains("GivenName") = True Then
                        ActiveDirectoryOutputBuffer.GivenName = props("GivenName")(0).ToString()
                    End If
                    If props.Contains("EmployeeID") = True Then
                        ActiveDirectoryOutputBuffer.EmployeeID = props("EmployeeID")(0).ToString()
                    End If
                    If props.Contains("SN") = True Then
                        ActiveDirectoryOutputBuffer.SN = props("SN")(0).ToString()
                    End If
                    If props.Contains("Description") = True Then
                        ActiveDirectoryOutputBuffer.Description = props("Description")(0).ToString()
                    End If
                    If props.Contains("DN") = True Then
                        ActiveDirectoryOutputBuffer.DN = props("DN")(0).ToString()
                    End If
                    If props.Contains("createTimeStamp") = True Then
                        ActiveDirectoryOutputBuffer.createTimeStamp = props("createTimeStamp")(0).ToString()
                    End If
                    If props.Contains("homeMDB") = True Then
                        ActiveDirectoryOutputBuffer.homeMDB = props("homeMDB")(0).ToString()
                    End If
                    If props.Contains("mDBStorageQuota") = True Then
                        ActiveDirectoryOutputBuffer.mDBStorageQuota = props("mDBStorageQuota")(0).ToString()
                    End If
                    If props.Contains("mDBOverHardQuotaLimit") = True Then
                        ActiveDirectoryOutputBuffer.mDBOverHardQuotaLimit = props("mDBOverHardQuotaLimit")(0).ToString()
                    End If
                    If props.Contains("mDBOverQuotaLimit") = True Then
                        ActiveDirectoryOutputBuffer.mDBOverQuotaLimit = props("mDBOverQuotaLimit")(0).ToString()
                    End If
                    If props.Contains("mDBUseDefaults") = True Then
                        ActiveDirectoryOutputBuffer.mDBUseDefaults = props("mDBUseDefaults")(0).ToString()
                    End If
                    If props.Contains("msRTCSIP-UserEnabled") = True Then
                        ActiveDirectoryOutputBuffer.msRTCSIPUserEnabled = props("msRTCSIP-UserEnabled")(0).ToString()
                    End If
                    If props.Contains("Pwdlastset") = True Then
                        ActiveDirectoryOutputBuffer.Pwdlastset = props("Pwdlastset")(0).ToString()
                    End If
                    If props.Contains("useraccountcontrol") = True Then
                        ActiveDirectoryOutputBuffer.useraccountcontrol = props("useraccountcontrol")(0).ToString
                    End If
                Next
            End Using
        End Using
        de = Nothing
        searcher = Nothing
        search_result = Nothing
        result = Nothing
        props = Nothing
        MemberOfList = Nothing
    End Sub
End Class


ns100


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>