'The following GUID is for the ID of the typelib if this project is exposed to COM ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: ' ]]> _ Public Class UserComponent Inherits ScriptComponentPlus Public Connections As New Connections(Me) Public Variables As New Variables(Me) Public Overrides Sub ProcessInput(ByVal InputID As Integer, ByVal InputName As String, ByVal Buffer As PipelineBuffer, ByVal OutputMap As OutputNameMap) If InputID = MyBase.ComponentMetaData.InputCollection("Input").ID Then Input_ProcessInput(New InputBuffer(Me, InputID, True, Buffer, OutputMap)) End If End Sub Public Overridable Sub Input_ProcessInput(ByVal Buffer As InputBuffer) While Buffer.NextRow() Input_ProcessInputRow(Buffer) End While End Sub Public Overridable Sub Input_ProcessInputRow(ByVal Row As InputBuffer) End Sub End Class Public Class Connections Dim ParentComponent As ScriptComponent _ Public Sub New(ByVal Component As ScriptComponent) ParentComponent = Component End Sub Public ReadOnly Property CrmConnection() As IDTSConnectionManager100 Get Return ParentComponent.ComponentMetaData.RuntimeConnectionCollection("CrmConnection").ConnectionManager End Get End Property End Class Public Class Variables Dim ParentComponent As ScriptComponent _ Public Sub New(ByVal Component As ScriptComponent) ParentComponent = Component End Sub End Class ]]> _ _ _ _ Public Class ScriptMain Inherits UserComponent ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Overrides Sub Input_ProcessInputRow(ByVal Row As InputBuffer) Try Dim recordName As String = Row.Buffer(m_rnIndex).ToString() Dim recordId As Guid = New Guid(Row.Buffer(m_riIndex).ToString()) Dim userId As Guid = New Guid(Row.Buffer(m_uiIndex).ToString()) Dim req As New OrganizationRequest req.RequestName = m_requestName ' Setup record. Dim record As New EntityReference record.LogicalName = recordName record.Id = recordId req("Record") = record req("SystemUserId") = userId req("TeamTemplateId") = Me.TeamTemplate ' Execute action. Call m_service.Execute(req) Catch ex As SoapException Call FireError_(ex.Detail.InnerXml) Catch ex As Exception Call FireError_(ex.Message) End Try End Sub ' Input_ProcessInputRow ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Overrides Sub PreExecute() Call MyBase.PreExecute() ' Setup CRM service. m_connection = CType( _ Me.Connections.CrmConnection.AcquireConnection(Nothing), _ IConnection) Call m_connection.Connect() m_service = CType(m_connection.GetService(0), OrganizationServiceClient) ' 0 - CRM Service ' Setup request. Select Case Me.Action Case ActionTypes.Add m_requestName = "AddUserToRecordTeam" Case ActionTypes.Remove m_requestName = "RemoveUserFromRecordTeam" Case Else Throw New ApplicationException("Unhandled action type.") End Select Dim input As IDTSInput100 = MyBase.ComponentMetaData.InputCollection(0) Dim inputCol As IDTSInputColumn100 ' Get input column indexes. inputCol = GetInputColumn_("RecordName") m_rnIndex = Me.HostComponent.BufferManager.FindColumnByLineageID( _ input.Buffer, _ inputCol.LineageID) inputCol = GetInputColumn_("RecordId") m_riIndex = Me.HostComponent.BufferManager.FindColumnByLineageID( _ input.Buffer, _ inputCol.LineageID) inputCol = GetInputColumn_("UserId") m_uiIndex = Me.HostComponent.BufferManager.FindColumnByLineageID( _ input.Buffer, _ inputCol.LineageID) End Sub ' PreExecute ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Overrides Sub PostExecute() Call MyBase.PostExecute() Call m_connection.Close() m_rnIndex = -1 m_riIndex = -1 m_uiIndex = -1 End Sub ' PostExecute ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function Validate(ByRef errMessage As String) As Boolean Dim result As Boolean Try If String.IsNullOrEmpty(Me.CrmConnection) Then Throw New Exception("Select Dynamics CRM Connection.") End If If Me.TeamTemplate.Equals(Guid.Empty) Then Throw New Exception("Specify team template identifier.") End If Dim input As IDTSInput100 = Me.ComponentMetaData.InputCollection(0) If input.IsAttached AndAlso input.InputColumnCollection.Count < 3 Then Throw New Exception("Map input columns.") End If ' Store connection information in the runtime connection collection, too. ' Cannot directly use RuntimeConnectionCollection in the property get/set ' because of issues with multi-threading. Me.ComponentMetaData.RuntimeConnectionCollection("CrmConnection").ConnectionManagerID = Me.CrmConnection result = True Catch ex As Exception result = False errMessage = ex.Message End Try Validate = result End Function 'Validate ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Overrides Sub ReinitializeMetaData() Call MyBase.ReinitializeMetaData() If MyBase.ComponentMetaData.InputCollection.Count = 0 Then ' At least one input must exist. Throw New Exception("No inputs.") End If Dim input As IDTSInput100 = MyBase.ComponentMetaData.InputCollection(0) ' Cleanup. input.ExternalMetadataColumnCollection.IsUsed = True Call input.InputColumnCollection.RemoveAll() Call input.ExternalMetadataColumnCollection.RemoveAll() Dim column As IDTSExternalMetadataColumn100 ' Setup record name column. column = input.ExternalMetadataColumnCollection.[New]() column.Name = "RecordName" column.DataType = DataType.DT_WSTR column.Length = 250 ' Setup record id column. column = input.ExternalMetadataColumnCollection.[New]() column.Name = "RecordId" column.DataType = DataType.DT_GUID ' Setup user id column. column = input.ExternalMetadataColumnCollection.[New]() column.Name = "UserId" column.DataType = DataType.DT_GUID End Sub ' ReinitializeMetaData #Region "Properties" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' _ _ Public Property CrmConnection() As String Get CrmConnection = m_crmConnection End Get Set(ByVal value As String) m_crmConnection = value End Set End Property ' CrmConnection ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' _ _ Public Property Action() As ActionTypes Get Action = m_action End Get Set(ByVal value As ActionTypes) m_action = value End Set End Property ' Action ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' _ Public Property TeamTemplate() As Guid Get TeamTemplate = m_teamTemplate End Get Set(ByVal value As Guid) m_teamTemplate = value End Set End Property ' TeamTemplate #End Region ' Properties #Region "Internals" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private ReadOnly Property CrmConnectionType() As String() Get CrmConnectionType = New String() {"DYNAMICS-CRM"} End Get End Property ' CrmConnectionType ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub FireError_(ByVal message As String) Dim cancel As Boolean = False Call MyBase.ComponentMetaData.FireError( _ 0, _ "Dynamics CRM Access Teams", _ message, _ String.Empty, _ 0, _ cancel) End Sub ' FireError_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Function GetInputColumn_(ByVal externalName As String) As IDTSInputColumn100 Dim result As IDTSInputColumn100 = Nothing Dim input As IDTSInput100 = MyBase.ComponentMetaData.InputCollection(0) Dim extColumn As IDTSExternalMetadataColumn100 = input.ExternalMetadataColumnCollection(externalName) ' Find input column for specified external column. For Each inputCol As IDTSInputColumn100 In input.InputColumnCollection If inputCol.ExternalMetadataColumnID = extColumn.ID Then ' Found input column. result = inputCol Exit For End If Next If result Is Nothing Then Throw New Exception("Input column not found.") End If GetInputColumn_ = result End Function ' GetInputColumn_ #End Region ' Internals #Region "Attributes" Enum ActionTypes Add Remove End Enum ' ActionTypes Private m_crmConnection As String Private m_action As ActionTypes Private m_teamTemplate As Guid Private m_connection As IConnection Private m_service As OrganizationServiceClient Private m_requestName As String Private m_rnIndex As Integer Private m_riIndex As Integer Private m_uiIndex As Integer #End Region ' Attributes End Class ' ScriptMain ]]> _ Public Class InputBuffer Inherits ScriptBufferPlus Public Sub New(ByVal Component As ScriptComponent, ByVal ObjectID As Integer, ByVal IsInput As Boolean, ByVal Buffer As PipelineBuffer, ByVal OutputMap As OutputNameMap) MyBase.New(Component, ObjectID, IsInput, Buffer, OutputMap) End Sub Public Overrides ReadOnly Property StaticInputColumns() As String() Get Return New String() {} End Get End Property Public Overrides ReadOnly Property StaticOutputColumns() As String() Get Return New String() {} End Get End Property Public Overloads Function NextRow() As Boolean NextRow = MyBase.NextRow() End Function Public Overloads Function EndOfRowset() As Boolean EndOfRowset = MyBase.EndOfRowset End Function End Class ]]> ]]> ' This code was generated by a tool. ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On Partial Friend NotInheritable Class MySettings Inherits System.Configuration.ApplicationSettingsBase Private Shared m_Value As MySettings Private Shared m_SyncObject As Object = New Object _ Public Shared ReadOnly Property Value() As MySettings Get If (MySettings.m_Value Is Nothing) Then System.Threading.Monitor.Enter(MySettings.m_SyncObject) If (MySettings.m_Value Is Nothing) Then Try MySettings.m_Value = New MySettings Finally System.Threading.Monitor.Exit(MySettings.m_SyncObject) End Try End If End If Return MySettings.m_Value End Get End Property End Class ]]> msBuild Reference;Import;Folder {D3662A8F-CA12-4147-997A-927BC94FA9B2} scriptcomponent_8beb7767ec79423e94e3d3b0ab5f067b scriptcomponent_8beb7767ec79423e94e3d3b0ab5f067b ]]> {30D016F9-3734-4E33-A861-5E7D899E18F3};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} Debug AnyCPU Library ScriptComponent_8beb7767ec79423e94e3d3b0ab5f067b.vbproj ScriptComponent_8beb7767ec79423e94e3d3b0ab5f067b.vbproj On Binary Off On {A2A1A6B8-6008-42BF-9997-AA96A2BD4BB3} true true true false bin\ false false 42016,42017,42018,42019,42032,42353,42354,42355 false true false true bin\ false false 42016,42017,42018,42019,42032,42353,42354,42355 False C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\CozyRoc.SSISPlus.2012.dll False C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ManagedDTS\v4.0_11.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ManagedDTS.dll Code VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources True True Resources.resx Code SettingsSingleFileGenerator Settings.Designer.vb True Settings.settings Code SSIS_SC110 v4.0 ]]> text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ]]> ' This code was generated by a tool. ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On Namespace My.Resources ''' ''' A strongly-typed resource class, for looking up localized strings, etc. ''' 'This class was auto-generated by the Strongly Typed Resource Builder 'class via a tool like ResGen or Visual Studio.NET. 'To add or remove a member, edit your .ResX file then rerun ResGen 'with the /str option, or rebuild your VS project. Class MyResources Private Shared _resMgr As System.Resources.ResourceManager Private Shared _resCulture As System.Globalization.CultureInfo Friend Sub New() MyBase.New End Sub ''' ''' Returns the cached ResourceManager instance used by this class. ''' _ Public Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager Get If (_resMgr Is Nothing) Then Dim temp As System.Resources.ResourceManager = New System.Resources.ResourceManager("My.Resources.MyResources", GetType(MyResources).Assembly) _resMgr = temp End If Return _resMgr End Get End Property ''' ''' Overrides the current thread's CurrentUICulture property for all ''' resource lookups using this strongly typed resource class. ''' _ Public Shared Property Culture() As System.Globalization.CultureInfo Get Return _resCulture End Get Set _resCulture = value End Set End Property End Class End Namespace ]]>CozyRoc.SqlServer.SSIS.ScriptComponentHostPlus, CozyRoc.SSISPlus.2012, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16cf490bb80c34eaScriptComponent_8beb7767ec79423e94e3d3b0ab5f067bVisualBasic