I use below code to get first name, last name, email, and department from AD using VB.Net 1.1
Public Shared Function GetAttribute(ByVal username As String, ByVal pwd As String) As UserInfo
Dim objUserInfo As New UserInfo
Dim ObjFirstName As String = ""
Dim ObjLastName As String = String.Empty
Dim ObjEmail As String = ""
Dim objDepartment As String = ""
Dim Success As Boolean = False
Dim LDAPAddress As String = ConfigurationSettings.AppSettings.Get("LDAPAddress")
Dim Entry As New System.DirectoryServices.DirectoryEntry(LDAPAddress, username, pwd)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Dim Filter As String = "(samAccountName=" & username & ")"
Dim findUser As DirectorySearcher = New DirectorySearcher(Entry, Filter)
Dim results As SearchResultCollection = findUser.FindAll
Try
Dim Resultsx As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Resultsx Is Nothing)
findUser.PropertiesToLoad.Add("name")
Dim name As String = DirectCast(Resultsx.Properties(name)(0), String)
Dim de As System.DirectoryServices.DirectoryEntry = Resultsx.GetDirectoryEntry()
Dim gg = de.Properties.PropertyNames()
For Each Onn As String In gg
Dim str As String = String.Format("{0}", Onn)
Next
Try
ObjFirstName = de.Properties("GivenName").Value.ToString()
ObjEmail = de.Properties("mail").Value.ToString()
ObjLastName = de.Properties("sn").Value.ToString()
objDepartment = de.Properties("department").Value.ToString()
Catch ex As Exception
ObjFirstName = de.Properties("DisplayName").Value.ToString()
End Try
But I can't get those attributes. in
Dim str As String = String.Format("{0}", Onn)
there are only 15 attributes, and there are no firstname, lastname, email, and department. What am I doing wrong?
Your code, though old-fashioned, looks fine on first sight. If you insist to continue with your code, I'll have a look later.
In the meantime, this code should fit your situation:
Dim user As DirectoryEntry = New DirectoryEntry("UserDN")
Dim src As DirectorySearcher = New DirectorySearcher(user, "(&(objectClass=user)(objectCategory=Person))")
src.PropertiesToLoad.Add("sn")
src.PropertiesToLoad.Add("givenName")
src.PropertiesToLoad.Add("mail")
src.PropertiesToLoad.Add("department")
Dim res As SearchResult = src.FindOne
Console.WriteLine(res.Properties("sn")(0))
Console.WriteLine(res.Properties("givenName")(0))
Console.WriteLine(res.Properties("mail")(0))
Console.WriteLine(res.Properties("department")(0))
Console.ReadLine()
Related
I have a folder with multiple text files in it, each text files has about 14 lines of text.
I would like to add all text files in that folder to a gridcontrol/gridview in vb.net.
My current code only adds 1 text file instead of adding all. any help would be greatly appreciated.
Dim path As String = "C:\Plan\"
For Each i As String In System.IO.Directory.GetFiles(path)
Dim a, b, c As String
a = System.IO.Path.GetFileNameWithoutExtension(i)
b = System.IO.Path.GetFileName(i)
c = System.IO.Path.GetFullPath(i)
Dim LINE_pair As String = IO.File.ReadLines(i).ElementAtOrDefault(0)
Dim LINE1_details As String = IO.File.ReadLines(i).ElementAtOrDefault(1)
Dim LINE2_outlookcombo As String = IO.File.ReadLines(i).ElementAtOrDefault(2)
Dim LINE3_rsicombo As String = IO.File.ReadLines(i).ElementAtOrDefault(3)
Dim LINE4_macdcombo As String = IO.File.ReadLines(i).ElementAtOrDefault(4)
Dim LINE4_ratio As String = IO.File.ReadLines(i).ElementAtOrDefault(5)
Dim LINE5_pattern As String = IO.File.ReadLines(i).ElementAtOrDefault(6)
Dim LINE6_none As String = IO.File.ReadLines(i).ElementAtOrDefault(7)
Dim LINE7_timeframecomvo As String = IO.File.ReadLines(i).ElementAtOrDefault(8)
Dim LINE7_date As String = IO.File.ReadLines(i).ElementAtOrDefault(9)
Dim LINE8_trade As String = IO.File.ReadLines(i).ElementAtOrDefault(10)
Dim LINE9_currentprice As String = IO.File.ReadLines(i).ElementAtOrDefault(11)
Dim LINE10_tp As String = IO.File.ReadLines(i).ElementAtOrDefault(12)
Dim LINE11_sl As String = IO.File.ReadLines(i).ElementAtOrDefault(13)
Dim NewItem As New ListViewItem(a)
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(13) {New DataColumn("Pair"), New DataColumn("Outlook"), New DataColumn("RSI"), New DataColumn("MACD"), New DataColumn("Pattern"), New DataColumn("Misc"), New DataColumn("Rato"), New DataColumn("Time Frame"), New DataColumn("Date"), New DataColumn("File name"), New DataColumn("Trade Status"), New DataColumn("CP"), New DataColumn("TP"), New DataColumn("SL")})
dt.Rows.Add(New String() {LINE_pair, LINE2_outlookcombo, LINE3_rsicombo, LINE4_macdcombo, LINE5_pattern, LINE6_none, LINE4_ratio, LINE7_timeframecomvo, LINE7_date, a, LINE8_trade, LINE9_currentprice, LINE10_tp, LINE11_sl})
GridControl1.DataSource = dt
It is not necessary to declare the DataColumn array explicitly. It is created internally from the items in the braces.
You are throwing away your NewItem on each iteration. Why not add them to a list and add them all at once to a ListView.
You are reading the file over and over as you assign the LINE_ data. Read it once and use the resulting lines array.
You never use b and c in this code so I deleted them
I tested in with a .net DataGridView. The file io methods and the DataTable are the same.
Private Sub OPCode()
Dim path As String = "C:\Plan\"
Dim dt As New DataTable()
Dim lstListViewItems As New List(Of ListViewItem)
dt.Columns.AddRange({New DataColumn("Pair"), New DataColumn("Outlook"), New DataColumn("RSI"), New DataColumn("MACD"), New DataColumn("Pattern"), New DataColumn("Misc"), New DataColumn("Rato"), New DataColumn("Time Frame"), New DataColumn("Date"), New DataColumn("File name"), New DataColumn("Trade Status"), New DataColumn("CP"), New DataColumn("TP"), New DataColumn("SL")})
For Each i As String In System.IO.Directory.GetFiles(path)
Dim a = System.IO.Path.GetFileNameWithoutExtension(i)
Dim lines = File.ReadLines(i)
Dim LINE_pair As String = lines.ElementAtOrDefault(0)
Dim LINE1_details As String = lines.ElementAtOrDefault(1)
Dim LINE2_outlookcombo As String = lines.ElementAtOrDefault(2)
Dim LINE3_rsicombo As String = lines.ElementAtOrDefault(3)
Dim LINE4_macdcombo As String = lines.ElementAtOrDefault(4)
Dim LINE4_ratio As String = lines.ElementAtOrDefault(5)
Dim LINE5_pattern As String = lines.ElementAtOrDefault(6)
Dim LINE6_none As String = lines.ElementAtOrDefault(7)
Dim LINE7_timeframecomvo As String = lines.ElementAtOrDefault(8)
Dim LINE7_date As String = lines.ElementAtOrDefault(9)
Dim LINE8_trade As String = lines.ElementAtOrDefault(10)
Dim LINE9_currentprice As String = lines.ElementAtOrDefault(11)
Dim LINE10_tp As String = lines.ElementAtOrDefault(12)
Dim LINE11_sl As String = lines.ElementAtOrDefault(13)
dt.Rows.Add({LINE_pair, LINE2_outlookcombo, LINE3_rsicombo, LINE4_macdcombo, LINE5_pattern, LINE6_none, LINE4_ratio, LINE7_timeframecomvo, LINE7_date, a, LINE8_trade, LINE9_currentprice, LINE10_tp, LINE11_sl})
Dim NewItem As New ListViewItem(a)
lstListViewItems.Add(NewItem)
Next
ListView1.Items.AddRange(lstListViewItems.ToArray)
DataGridView1.DataSource = dt
End Sub
This is the code that i have made but now working to save the report to the directory:
As you see i follow pretty much a lot of microsoft tutorials of how use this class of reporting service, but still dont get how get it working
'objetos de reporting
Dim rs As New reportingservice.ReportingService2010
Dim rsExec As New ReportExecution.ReportExecutionService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
'datos generales
Dim historyID As String = Nothing
Dim deviceInfo As String = Nothing
Dim format As String = "PDF"
Dim results As Byte()
Dim encoding As String = String.Empty
Dim mimeType As String = String.Empty
Dim extension As String = String.Empty
Dim warnings As ReportExecution.Warning() = Nothing
Dim streamIDs As String() = Nothing
Dim filename As String = "C:/Users/gdedieu/Desktop/reporte.pdf" ' Change to where you want to save
Dim _reportName As String = "per_anexo_1"
Dim _historyID As String = Nothing
Dim _forRendering As Boolean = False
Dim _values As ReportExecution.ParameterValue() = Nothing
Dim _credentials As reportingservice.DataSourceCredentials() = Nothing
Dim ei As ReportExecution.ExecutionInfo = rsExec.LoadReport(_reportName, historyID)
'definimos el parĂ¡metro
_values(0).Name = "an1_id"
_values(0).Value = 1
rsExec.SetExecutionParameters(_values, "en-us")
results = rsExec.Render(format, deviceInfo, extension, mimeType, encoding, warnings, streamIDs)
Dim stream As New System.IO.FileStream(filename, IO.FileMode.OpenOrCreate)
stream.Write(results, 0, results.Length)
stream.Close()
Try setting up a subscription via the Report Manager and specifying the Report Delivery Options value for 'Delivered By:' as 'Report Server File Share'.
This lets you specify a path for a report file to be written to - you will need to ensure that the Reporting Services server has write access to the destination.
VS 2010, VB.NET, WINFORMS. In my app i have a need to import foxpro database tables and exclude the deleted records. The problem is that FOXPRO tables keep deleted items inside the same table. I have tried using DELETED=NO in the connection string but vb throws
"Format of the initialization string does not conform to the OLE DB specification."
My function is as follows:
Dim _DBConn1 As String = "provider=vfpoledb.1; Data Source = " & file1 & ";DELETED=NO"
Dim _DBConn2 As String = "provider=vfpoledb.1; Data Source = " & file2 & ";DELETED=NO"
Dim _DBConn3 As String = "provider=vfpoledb.1; Data Source = " & file3 & ";DELETED=NO"
Dim _DBConn4 As String = "provider=vfpoledb.1; Data Source = " & file4 & ";DELETED=NO"
Using _connection As New OleDbConnection(_DBConn1)
Dim _savedId As String = String.Empty
_connection.Open()
Using _command As New OleDbCommand("SELECT * FROM " & _fileName1 & "", _connection)
Using _reader2 As OleDbDataReader = _command.ExecuteReader
While _reader2.Read
counter += 1
End While
y = 100 / counter
Dim x As String = String.Empty
End Using
Using _reader As OleDbDataReader = _command.ExecuteReader
While _reader.Read
Dim _letter As Integer = Nothing
Dim _name As String = String.Empty
Dim _content As String = String.Empty
Dim _copies As Integer = Nothing
Dim _type As Integer = Nothing
Dim _fee As Decimal = Nothing
_letter = _reader.Item(0)
_name = _reader.Item(1)
_content = _reader.Item(2)
_copies = _reader.Item(3)
_type = _reader.Item(4)
_fee = _reader.Item(5)
_UpdateLetters(_letter, _name, _content, _copies, _type, _fee)
_progress += y
Dim d As Integer = Convert.ToInt16((Convert.ToString(y).Split(".")(0)))
ProgressBar1.Increment(d)
End While
End Using
End Using
_connection.Close()
End Using
Using _connection As New OleDbConnection(_DBConn2)
Dim _savedId As String = String.Empty
_connection.Open()
Using _command As New OleDbCommand("SELECT * FROM " & _fileName2 & "", _connection)
Using _reader2 As OleDbDataReader = _command.ExecuteReader
While _reader2.Read
counter += 1
End While
y = 100 / counter
Dim x As String = String.Empty
End Using
Using _reader As OleDbDataReader = _command.ExecuteReader
While _reader.Read
Dim _unit As String = String.Empty
Dim _Size As String = String.Empty
Dim _contractDate As String = String.Empty
Dim _deposit As Decimal = Nothing
Dim _Tfirst As String = String.Empty
Dim _Tlast As String = String.Empty
Dim _optional As String = String.Empty
Dim _address1 As String = String.Empty
Dim _address2 As String = String.Empty
Dim _city As String = String.Empty
Dim _st As String = String.Empty
Dim _zip As String = String.Empty
Dim _hphone As String = String.Empty
Dim _drLicense As String = String.Empty
Dim _employer As String = String.Empty
Dim _wphone As String = String.Empty
Dim _bname As String = String.Empty
Dim _baddress1 As String = String.Empty
Dim _baddress2 As String = String.Empty
Dim _bCity As String = String.Empty
Dim _bState As String = String.Empty
Dim _bZip As String = String.Empty
Dim _bPhone As String = String.Empty
Dim _contact_Name As String = String.Empty
Dim _contact_Address1 As String = String.Empty
Dim _contact_Address2 As String = String.Empty
Dim _contact_City As String = String.Empty
Dim _contact_State As String = String.Empty
Dim _contact_zip As String = String.Empty
Dim _contact_phone As String = String.Empty
Dim _balance As Decimal = Nothing
Dim _lastPaymentDate As String = String.Empty
Dim _lastPayAmount As Decimal = Nothing
Dim _memo As String = String.Empty
Dim _lateFee As Decimal = Nothing
Dim _email As String = String.Empty
_unit = _reader.Item(0)
_Size = _reader.Item(1)
_contractDate = _reader.Item(2)
_deposit = _reader.Item(3)
_Tfirst = _reader.Item(4)
_Tlast = _reader.Item(5)
_optional = _reader.Item(6)
_address1 = _reader.Item(7)
_address2 = _reader.Item(8)
_city = _reader.Item(9)
_st = _reader.Item(10)
_zip = _reader.Item(11)
_hphone = _reader.Item(12)
_drLicense = _reader.Item(13)
_employer = _reader.Item(15)
_wphone = _reader.Item(16)
_bname = _reader.Item(17)
_baddress1 = _reader.Item(18)
_baddress2 = _reader.Item(19)
_bCity = _reader.Item(20)
_bState = _reader.Item(21)
_bZip = _reader.Item(22)
_bPhone = _reader.Item(23)
_contact_Name = _reader.Item(24)
_contact_Address1 = _reader.Item(25)
_contact_Address2 = _reader.Item(26)
_contact_City = _reader.Item(27)
_contact_State = _reader.Item(28)
_contact_zip = _reader.Item(29)
_contact_phone = _reader.Item(30)
_balance = _reader.Item(32)
_lastPaymentDate = _reader.Item(33)
_lastPayAmount = _reader.Item(34)
_memo = _reader.Item(46)
_lateFee = _reader.Item(49)
_email = _reader.Item(50)
_UpdateTenent(_unit, _Size, _contractDate, _deposit, _Tfirst, _Tlast, _optional, _address1, _address2, _city, _st, _zip, _hphone, _drLicense, _employer, _wphone, _bname, _baddress1, _baddress2, _bCity, _bState, _bZip, _bPhone, _contact_Name, _contact_Address1, _contact_Address2, _contact_City, _contact_State, _contact_zip, _contact_phone, _balance, _lastPaymentDate, _lastPayAmount, _memo, _lateFee, _email)
_progress += y
Dim d As Integer = Convert.ToInt16((Convert.ToString(y).Split(".")(0)))
ProgressBar2.Increment(d)
End While
End Using
End Using
_connection.Close()
End Using
Any ideas how my Connection string is wrong? Google results pointed me in the direction of DELETED=NO but its throwing that exception error now that I have added it..
The VfpOleDb provider excludes deleted records by default. So your connection string doesn't need to include the deleted setting. If you wanted to include delete records... you would include "deleted=false" in the connection string.
I'm able to authenticate given user - Domain, UserName and Password with LDAP but not able to retrive his groups which he associated with :(
Here the code i'm using
Public Function ValidateActiveDirectoryLogin(ByVal domainName As String, ByVal userName As String, ByVal userPassword As String) As Boolean
Dim isValidated As Boolean = False
Try
Dim ldapPath As String = "LDAP://" & domainName
Dim dirEntry As New DirectoryEntry(ldapPath, userName, userPassword, AuthenticationTypes.Secure)
Dim dirSearcher As New DirectorySearcher(dirEntry)
dirSearcher.Filter = "(SAMAccountName=" & userName & ")"
dirSearcher.PropertiesToLoad.Add("memberOf")
Dim result As SearchResult = dirSearcher.FindOne()
If Not result Is Nothing Then
For Each x As DictionaryEntry In result.Properties
x.Key.ToString()
'DirectCast(x, System.Collections.DictionaryEntry).Key()
Next
Dim groupCount As Integer = result.Properties("memberOf").Count
Dim isInGroup As Boolean = False
For index As Integer = 0 To groupCount - 1
Dim groupDN As String = result.Properties("memberOf").Item(index).ToString
Dim equalsIndex As Integer = groupDN.IndexOf("=")
Dim commaIndex As Integer = groupDN.IndexOf(",")
Dim group As String = groupDN.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1).ToLower
If group.Equals(groupName.ToLower) Then
isInGroup = True
Exit For
End If
Next index
isValidated = isInGroup
End If
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
Return isValidated
End Function
Please help...
Venky
Here is the way I will use, sorry it's code I translate from C# to VB.Net
` Connection to Active Directory
Dim deBase As DirectoryEntry = New DirectoryEntry("LDAP://192.168.183.100:389/dc=dom,dc=fr", "jpb", "pwd")
` Directory Search for the group your are interested in
Dim dsLookForGrp As DirectorySearcher = New DirectorySearcher(deBase)
dsLookForGrp.Filter = String.Format("(cn={0})", "yourgroup")
dsLookForGrp.SearchScope = SearchScope.Subtree
dsLookForGrp.PropertiesToLoad.Add("distinguishedName")
Dim srcGrp As SearchResult = dsLookForGrp.FindOne
If (Not (srcGrp) Is Nothing) Then
Dim dsLookForUsers As DirectorySearcher = New DirectorySearcher(deBase)
dsLookForUsers.Filter = String.Format("(&(objectCategory=person)(memberOf={0}))", srcGrp.Properties("distinguishedName")(0))
dsLookForUsers.SearchScope = SearchScope.Subtree
dsLookForUsers.PropertiesToLoad.Add("objectSid")
dsLookForUsers.PropertiesToLoad.Add("userPrincipalName ")
dsLookForUsers.PropertiesToLoad.Add("sAMAccountName")
Dim srcLstUsers As SearchResultCollection = dsLookForUsers.FindAll
For Each sruser As SearchResult In srcLstUsers
Console.WriteLine("{0}", sruser.Path)
` Here Test if you username is insode
Console.WriteLine(""& vbTab&"{0} : {1} ", "sAMAccountName", sruser.Properties("sAMAccountName")(0))
Next
End If
Be careful the primary group is given by the primaryGroupID and it's not a DN but an ID which is the lasr part of the group SID.
Last thing, But you can also do it using Managing Directory Security Principals in the .NET Framework 3.5. Here is a sample in C#
/* Retreiving a principal context
*/
Console.WriteLine("Retreiving a principal context");
PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, "WM2008R2ENT:389", "dc=dom,dc=fr", "jpb", "PWD");
/* Look for all the groups a user belongs to
*/
UserPrincipal aUser = UserPrincipal.FindByIdentity(domainContext, "user1");
PrincipalSearchResult<Principal> a = aUser.GetAuthorizationGroups();
foreach (GroupPrincipal gTmp in a)
{
Console.WriteLine(gTmp.Name);
}
I have a report already setup on the ReportServer. And its subscription as well. What I'm trying to do is add the ParameterValue "CC" and some email addresses then send the email out. It doesn't seem to work.
My code:
Dim emailReader As SqlDataReader = selCount.ExecuteReader
Dim emailsTest As List(Of String) = New List(Of String)
emailsTest.Add("test1#pen.com")
emailsTest.Add("test2#pen.com")
emailsTest.Add("test3#pen.com")
emailsTest.Add("test4#pen.com")
If emailReader.HasRows() Then 'checks to see if there any quotes in query
For Each subscrp As rs.Subscription In subscr
Dim allValues = subscrp.DeliverySettings.ParameterValues
Dim allValuesList As List(Of ReportTriggerTemplate1.rs.ParameterValueOrFieldReference) = allValues.ToList()
Dim CCParameter As ReportTriggerTemplate1.rs.ParameterValue = New ReportTriggerTemplate1.rs.ParameterValue()
CCParameter.Name = "CC"
CCParameter.Value = String.Empty
allValuesList.Add(CCParameter)
Dim toValue = CType(allValuesList.Item(7), ReportTriggerTemplate1.rs.ParameterValue)
For Each testEmail As String In emailsTest
Dim ownerEmail As String = testEmail
If toValue.Value.Contains(ownerEmail) Then
'skip
ElseIf toValue.Value = String.Empty Then
toValue.Value += ownerEmail
Else
toValue.Value += "; " & ownerEmail
End If
Next
subscrp.DeliverySettings.ParameterValues = allValuesList.ToArray()
Dim hello As String = "hi"
tr.FireEvent(EventType, subscrp.SubscriptionID) 'forces subscription to be sent
Next
What I'm adding to toValue.Value doesn't seem to be adding to the report's CC subscription field at all. So what am I missing?
http://msdn.microsoft.com/en-us/library/ms154020%28v=SQL.100%29.aspx
http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.getsubscriptionproperties.aspx
http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.setsubscriptionproperties%28v=SQL.105%29.aspx
Try
tr = New rs.ReportingService2005
Dim extSettings As ExtensionSettings = Nothing
Dim desc As String = Nothing
Dim active As ActiveState = Nothing
Dim status As String = Nothing
Dim matchData As String = Nothing
Dim values As ParameterValue() = Nothing
Dim extensionParams As ParameterValueOrFieldReference() = Nothing
Dim mainLogin As System.Net.NetworkCredential = New System.Net.NetworkCredential("ADUser", "Password", "NetworkName")
If mainLogin Is Nothing Then
tr.Credentials = System.Net.CredentialCache.DefaultCredentials
Else
tr.Credentials = mainLogin
End If
'skip to relevant code
For Each subscrp As rs.Subscription In subscr
Dim allValues = subscrp.DeliverySettings.ParameterValues
Dim allValuesList As List(Of ReportTriggerTemplate1.rs.ParameterValueOrFieldReference) = allValues.ToList()
If CType(allValuesList.Item(0), ReportTriggerTemplate1.rs.ParameterValue).Value = "test#pen.com" Then
Dim subsID = subscrp.SubscriptionID
'important code just below
tr.GetSubscriptionProperties(subsID, extSettings, desc, active, status, EventType, matchData, extensionParams)
''''add change to CC here
Dim extSettingsList As List(Of ReportTriggerTemplate1.rs.ParameterValueOrFieldReference) = extSettings.ParameterValues.ToList()
If CType(extSettingsList.Item(1), ReportTriggerTemplate1.rs.ParameterValue).Name = "CC" Then
If CType(extSettingsList.Item(1), ReportTriggerTemplate1.rs.ParameterValue).Value = String.Empty Then
CType(extSettingsList.Item(1), ReportTriggerTemplate1.rs.ParameterValue).Value = emailsTest.Item(0) & ";" & emailsTest.Item(1)
Else
CType(extSettingsList.Item(1), ReportTriggerTemplate1.rs.ParameterValue).Value += ";" & emailsTest.Item(0) & ";" & emailsTest.Item(1)
End If
Else
Dim CCParameter As ReportTriggerTemplate1.rs.ParameterValue = New ReportTriggerTemplate1.rs.ParameterValue()
CCParameter.Name = "CC"
CCParameter.Value = emailsTest.Item(0) & ";" & emailsTest.Item(1)
extSettingsList.Insert(1, CCParameter)
extSettings.ParameterValues = extSettingsList.ToArray
End If
'important code just below
tr.SetSubscriptionProperties(subsID, extSettings, desc, EventType, matchData, extensionParams)
tr.FireEvent(EventType, subscrp.SubscriptionID) 'forces subscription to be sent
Else
End If
Next