Task schedule in windows server from other computer - vb.net

I am scheduling a task from vb.net with these parameters. Generates the task correctly and executes it. This works correctly in local, but I need that task to be created on the server. Any ideas?
Using tService As New TaskService()
Dim Fecha As DateTime = DateTime.Parse(txtFDesde.Text + " " + txtHDesde.Text)
Dim tTime As New TimeTrigger()
Dim tDefinition As TaskDefinition = tService.NewTask
tDefinition.RegistrationInfo.Description = "Tarea programada para ejecutar"
tDefinition.Settings.RunOnlyIfLoggedOn = False
tTime.StartBoundary = New DateTime(Fecha.Year, Fecha.Month, Fecha.Day, Fecha.Hour, Fecha.Minute, 0)
tDefinition.Triggers.Add(tTime)
Dim url As String = "http://localhost:5000/" & Param
tDefinition.Actions.Add(New ExecAction("cmd.exe", "/c start " & url))
tService.RootFolder.RegisterTaskDefinition("Test " & Param, tDefinition)
End Using

Try the static connect method...you'll need credentials to the server....https://msdn.microsoft.com/en-us/library/windows/desktop/aa383451(v=vs.85).aspx

This is working, I just have to add the server paramters on "Connect()"
Const TriggerTypeTime = 1
Const ActionTypeExec = 0
Dim service = CreateObject("Schedule.Service")
Call service.Connect()
Dim rootFolder
rootFolder = service.GetFolder("\")
Dim taskDefinition
taskDefinition = service.NewTask(0)
Dim regInfo
regInfo = taskDefinition.RegistrationInfo
regInfo.Description = "Testing"
regInfo.Author = "Me"
Dim principal
principal = taskDefinition.Principal
' revisar
principal.LogonType = 3
Dim settings
settings = taskDefinition.Settings
settings.Enabled = True
settings.StartWhenAvailable = True
settings.Hidden = False
Dim triggers
triggers = taskDefinition.Triggers
Dim trigger
trigger = triggers.Create(TriggerTypeTime)
Dim startTime
startTime = L_TraducirParaTrigger(Fecha)
trigger.StartBoundary = startTime
trigger.Id = "TimeTriggerId"
trigger.Enabled = True
Dim Action
Action = taskDefinition.Actions.Create(ActionTypeExec)
Action.Path = "C:\Windows\System32\cmd.exe"
Dim url As String = "http://localhost:5000/" & L_IdEjecucion
Action.Arguments = "/c start " & url
'revisar último parámetro
Call rootFolder.RegisterTaskDefinition(L_Id, taskDefinition, 6, , , 3)

Related

Error on event click + Getting data from database

I'm trying to run an event, but when I run it, I get the error:
The expression On Click you entered as the event property setting
produced the following error: The Expression you entered has a
function containing the wrong number of arguments.
The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
There may have been an error evaluating the function, even, or macro.
I'd use the following code:
Public Function CH05_Generate(Sagsnr As String)
Dim WordApp As Word.Application
Dim Doc As Word.Document
Dim WordPath As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sql As String
Set db = CurrentDb
sql = "SELECT * FROM Projektdata WHERE Sagsnr Like '" & Sagsnr & "'"
Set rst = db.OpenRecordset(sql, dbOpenDynaset)
WordPath = "My path (Can't show this"
Set WordApp = CreateObject("Word.Application")
Set Doc = WordApp.Documents.Add(WordPath)
With Doc
.FormFields("PName").Result = rst![Projektnavn]
.FormFields("text").Result = Forms![TD-E-PM200-CH05]!Kommentar
.FormFields("S3").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q1
.FormFields("S4").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q2
.FormFields("S5").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q3
.FormFields("S6").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q4
.FormFields("S7").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q5
.FormFields("S8").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q6
.FormFields("S9").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q7
.FormFields("S10").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q8
.FormFields("S11").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q9
.FormFields("S12").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q10
.FormFields("S13").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q11
.FormFields("S14").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q12
.FormFields("S15").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q13
.FormFields("S16").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q14
.FormFields("S17").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q15
.FormFields("S18").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q16
.FormFields("S19").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q17
.FormFields("S20").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q18
.FormFields("S21").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q19
.FormFields("S22").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q20
.FormFields("S23").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q21
.FormFields("S24").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q22
.FormFields("S25").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q23
.FormFields("S26").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q24
.FormFields("S27").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q25
.FormFields("S28").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q26
.FormFields("S29").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q27
.FormFields("S30").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q28
.FormFields("S31").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q29
.FormFields("S32").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q30
.FormFields("S33").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q31
.FormFields("S34").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q32
.FormFields("S35").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q33
.FormFields("S36").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q34
.FormFields("S37").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q35
End With
WordApp.visible = True
WordApp.Activate
WordApp.ActiveDocument.Protect wdAllowOnlyFormFields, True
End Function
What I want to achieve to get data from the "Projektdata" database, and get the correct data, "Projektnavn", to fill out:
.FormFields("PName").Result = rst![Projektnavn]
My database structure is like this:
"SELECT *
FROM dbo.Projektdata p
JOIN dbo.Items i ON p.Sagsnr = i.Sagsnr
WHERE ItemID =" & ItemID & " AND p.Sagsnr Like '" & Sagsnr & "'" -- change "," to AND
I call my function like this: =CH05_Generate()
Public Function CH05_Generate(Sagsnr As String, ItemID As String)
This cannot work - the function expects two parameters, you need to pass them in the function call.

Chinese filename as an attachment in email

Following is simple code to send the mail with an attachment:
/**************************************************/
Dim msgMail As New System.Web.Mail.MailMessage
Dim rcpName As String
Dim client As New SmtpClient
Dim i As Integer
Dim recips_addr() As String = Split(to_address, ";")
Dim recips_name() As String = Split(to_name, ";")
For i = 0 To recips_addr.Length - 1
rcpName = """" & recips_name(i) & """"
msgMail.To = rcpName & recips_addr(i) & ";"
Next
msgMail.From = from_address
msgMail.Subject = subject
msgMail.BodyFormat = System.Web.Mail.MailFormat.Html
msgMail.Body = message
msgMail.BodyEncoding = System.Text.Encoding.UTF8
If String.IsNullOrEmpty(attachment_path) Then attachment_path = "NONE"
If (attachment_path <> "NONE") Then
Dim att As New System.Web.Mail.MailAttachment(attachment_path)
msgMail.Attachments.Add(att)
End If
If send_to_sender Then
msgMail.Bcc = from_address
End If
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = My.Settings.smtp_Server
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = My.Settings.emailUsername
msgMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = My.Settings.emailPassword
System.Web.Mail.SmtpMail.Send(msgMail)
/**************************************************/
Now, the query is when i send a pdf file as an attachment using above code and file name is 'Report_出生地_出生地_出生地_6023.pdf'.
when i get the mail in my inbox the name of the file becomes 'Report____6023.pdf'.
I don't know why attachment filenames are changing.
Please help !!!!

dynamic table and button creation in asp.net

I have created a dynamic table using for loop condition.In which it has a button while i click a specific button it should open a file.But in my coding it is opening a file button in the last row.
If Not IsPostBack Then
txtlogsdate.Text = FormatDate(Now)
End If
Try
trViewlogs.Visible = True
lbllogs.Visible = False
lbllogname.Visible = True
RT1.Visible = False
pb.Visible = False
Dim d1 As DateTime = txtlogsdate.Text
Dim dd As String = d1.ToString("dd")
Dim mm As String = d1.ToString("MM")
Dim yy As String = d1.ToString("yy")
Dim d2 As String = yy & "" & mm & "" & dd
Dim di As DirectoryInfo = New DirectoryInfo(Server.MapPath("~\logs"))
Dim files As FileInfo() = di.GetFiles("*.log")
Dim tab As New Table()
tab.CellPadding = 0
tab.CellSpacing = 0
tab.BorderStyle = BorderStyle.Double
tab.Attributes.Add("style", "margin-left: 0.5px; width: 800px;")
Dim row As New TableRow()
Dim headerCell1 As New TableHeaderCell()
headerCell1.Text = "Logs"
headerCell1.Attributes.Add("style", "margin-left: 0.5px; height: 20px;")
headerCell1.BackColor = System.Drawing.Color.CornflowerBlue
headerCell1.ForeColor = System.Drawing.Color.White
row.Controls.Add(headerCell1)
tab.Controls.Add(row)
Dim headerCell2 = New TableHeaderCell()
headerCell2.Attributes.Add("style", "margin-left: 0.5px; height: 20px;")
headerCell2.BackColor = System.Drawing.Color.CornflowerBlue
headerCell2.ForeColor = System.Drawing.Color.White
headerCell2.Text = "Download"
row.Controls.Add(headerCell2)
tab.Controls.Add(row)
For i As Integer = 0 To files.Length - 1
Dim a As String = files(i).ToString.Replace("Event-", "")
Dim c As String = a.Substring(0, 6)
Dim sw As String
If d2 = c Then
sw = My.Computer.FileSystem.ReadAllText(_
GetWebSitePhysicalRoot & "\logs\" & files(i).ToString)
lbllogname.Text = files(i).ToString
lbllogname.Visible = False
row = New TableRow()
If i Mod 2 = 0 Then
row.BackColor = System.Drawing.Color.White
Else
row.BackColor = System.Drawing.Color.AliceBlue
End If
Dim cell As New TableCell()
cell.Text = lbllogname.Text
'cell.Width = New Unit("1000px")
cell.HorizontalAlign = HorizontalAlign.Center
row.Controls.Add(cell)
Dim cell2 As New TableCell()
Dim bt As New Button
bt.BorderStyle = BorderStyle.Solid
bt.Text = files(i).ToString
AddHandler bt.Click, AddressOf bt_Click
cell2.HorizontalAlign = HorizontalAlign.Center
cell2.Controls.Add(bt)
row.Controls.Add(cell2)
tab.Controls.Add(row)
Panel1.Controls.Add(tab)
End If
Next i
If lbllogname.Text = "" Then
lbllogname.Text = "No Logs to Display !"
End If
Session("pageurl") = ""
Session("pagecount") = ""
ib.SetInfo("Reports > View Logs", Infobar.InfoTypes.Caption)
Dim mi As Integer = GetQueryStringToInt("menuindex", 1)
If Not IsPostBack Then
leftmenu1.AddItem("View Logs", _
GetWebSiteUrlRoot & "/staff_rpt.aspx?rpt=logs&page=1&menuindex=" & mi)
End If
Catch ex As Exception
WriteLog(LogWriter.EventType.eError, ex.StackTrace.ToString)
End Try
Protected Sub bt_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs
Dim a As String
a = lbllogname.Text
Response.ContentType = "text/plain"
Response.AppendHeader("Content-Disposition", "attachment; filename=" & a)
Response.TransmitFile(Server.MapPath("~/logs/" & a))
Response.End()
End Sub
To use the dynamic table structure you have built in your code, then you need to uniquely name each button in each row; otherwise the button click handler (bt_Click) cannot figure out the correct row to open the file in, because they are all called the same and will use the last one.
Since you want a table structure, then I suggest you use the GridView server control, as it will provide similar output, but provide the ability to use templating to name the controls of each row the same, but allow for you to differentiate individual rows when a click event happens.

Docusign webservice using vb.net - anchor tags Custom

Here is the problem I am having.
I have a document that I am creating using the DocuSign webservice.
I can create normal fields/tabs on it ie SignHere / SignDate / Initial fields.
However when i wan to use a custom field it just doesn't work. The code runs and the document is sent but all that is in the place of the EXPECTED custom field is just a bisc text box. It's like it's just ignoring the custom field settings.
I have attached the document i am using for reference and my code is below.
Everything works but the parts where the 2 customer fields should be I think is the issue.
Dim DocuSignSoap As New ServiceReference2.DSAPIServiceSoapClient
Dim DocuSignRecipient(0) As ServiceReference2.Recipient
Dim DocuSignRecipientType As ServiceReference2.RecipientTypeCode
Dim DocuSignTabType As ServiceReference2.TabTypeCode
Dim DocuSignCustomTabType As ServiceReference2.CustomTabType
Dim DocuSignEnvelope As New ServiceReference2.Envelope
Dim DocuSignDocument(0) As ServiceReference2.Document
Dim DocuSignTab(7) As ServiceReference2.Tab
Dim DocuSignEnvelopeStatus As ServiceReference2.EnvelopeStatus
Dim DocusignSig1 As New ServiceReference2.AnchorTab
Dim DocusignSig2 As New ServiceReference2.AnchorTab
Dim DocusignDateLOA As New ServiceReference2.AnchorTab
Dim DocusignDDDate As New ServiceReference2.AnchorTab
Dim DocusignFreq1 As New ServiceReference2.AnchorTab
Dim DocusignFreq2 As New ServiceReference2.AnchorTab
Dim DocusignFreq3 As New ServiceReference2.AnchorTab
Dim DocusignFreq4 As New ServiceReference2.AnchorTab
Dim strAuth As String
Dim strDocID As String
strDocID = Format(Now, "ddMMyyyyhhmmss")
Dim Mystream As New FileStream("c:\dantestdocusign.pdf", FileMode.Open)
Dim filesize As Long = Mystream.Length
Dim buffer(filesize) As Byte
Mystream.Read(buffer, 0, filesize)
Mystream.Close()
'Create Recipent
DocuSignRecipient(0) = New ServiceReference2.Recipient
DocuSignRecipient(0).Email = "daniel.rodgers#idebtplan.co.uk"
DocuSignRecipient(0).UserName = "Daniel Rodgers"
DocuSignRecipient(0).SignerName = "Daniel Rodgers"
DocuSignRecipient(0).Type = DocuSignRecipientType.Signer
DocuSignRecipient(0).ID = "1"
DocuSignRecipient(0).RoutingOrder = 1
'Create the envelope content
DocuSignEnvelope.Subject = "Your iDebtPlan Pack"
DocuSignEnvelope.EmailBlurb = "Email content"
DocuSignEnvelope.Recipients = DocuSignRecipient
DocuSignEnvelope.AccountId = "2f447fb0-243a-4a3f-acb5-adefbef43492"
'Create the document
DocuSignDocument(0) = New ServiceReference2.Document
DocuSignDocument(0).ID = strDocID
DocuSignDocument(0).Name = "DAN TESTING DOC"
DocuSignDocument(0).PDFBytes = buffer
' Attach the document(s)
DocuSignEnvelope.Documents = DocuSignDocument
' Create a new signature tab 1
DocuSignTab(0) = New ServiceReference2.Tab
DocuSignTab(0).DocumentID = DocuSignDocument(0).ID
DocuSignTab(0).RecipientID = "1"
DocuSignTab(0).Type = DocuSignTabType.SignHere
DocusignSig1.AnchorTabString = "\s1\"
DocuSignTab(0).AnchorTabItem = DocusignSig1
DocuSignTab(0).TabLabel = "Sig1"
' Create a new signature tab 2
DocuSignTab(1) = New ServiceReference2.Tab
DocuSignTab(1).DocumentID = DocuSignDocument(0).ID
DocuSignTab(1).RecipientID = "1"
DocuSignTab(1).Type = DocuSignTabType.SignHere
DocusignSig2.AnchorTabString = "\s2\"
DocuSignTab(1).AnchorTabItem = DocusignSig2
DocuSignTab(1).TabLabel = "Sig2"
' Create a DateLOA
DocuSignTab(2) = New ServiceReference2.Tab
DocuSignTab(2).DocumentID = DocuSignDocument(0).ID
DocuSignTab(2).RecipientID = "1"
DocuSignTab(2).Type = DocuSignTabType.DateSigned
DocusignDateLOA.AnchorTabString = "\loadate\"
DocuSignTab(2).AnchorTabItem = DocusignDateLOA
DocuSignTab(2).TabLabel = "DateLOA"
'CUSTOM FIELD 1
' Create a DD Date
DocuSignTab(3) = New ServiceReference2.Tab
DocuSignTab(3).DocumentID = DocuSignDocument(0).ID
DocuSignTab(3).RecipientID = "1"
DocuSignTab(3).Type = 11
DocuSignTab(3).CustomTabType = 4 'date
DocuSignTab(3).CustomTabWidth = 100
DocuSignTab(3).CustomTabDisableAutoSize = True
DocuSignTab(3).CustomTabRequired = True
DocuSignTab(3).CustomTabValidationPattern ="(^(?:(?:[12][0-9]|0?[1-9])/0?2|(?:30|[12][0-9]|0?[1-9])/(?:0?[469]|11)|(?:3[01]|[12][0-9]|0?[1-9])/(?:0?[13578]|1[02]))/\d{4}$)"
DocuSignTab(3).MaxLength = 10
DocuSignTab(3).CustomTabValidationMessage = "Your First Payment Date
Must be format dd/mm/yyyy (example: 01/03/2012), and a valid UK Date"
DocusignDDDate.AnchorTabString = "\dddate\"
DocuSignTab(3).AnchorTabItem = DocusignDDDate
DocuSignTab(3).TabLabel = "DDDate"
'CUSTOM FIELD 2
''Create Frequency Radio Buttons
DocuSignTab(4) = New ServiceReference2.Tab
DocuSignTab(4).DocumentID = DocuSignDocument(0).ID
DocuSignTab(4).RecipientID = "1"
DocuSignTab(4).Type = 11
DocuSignTab(4).CustomTabType = 2 'radio
DocuSignTab(4).CustomTabRequired = True
DocuSignTab(4).CustomTabWidth = 100
DocuSignTab(4).CustomTabDisableAutoSize = True
DocuSignTab(4).CustomTabRadioGroupName = "Frequency"
DocuSignTab(4).TabLabel = "Frequency"
DocuSignTab(4).Value = ""
DocusignFreq1.AnchorTabString = "\ow\"
DocuSignTab(4).AnchorTabItem = DocusignFreq1
DocuSignEnvelope.Tabs = DocuSignTab
strAuth = "<DocuSignCredentials<Usernameinfo#idebtplan.co.uk<mailto:info#idebtplan.co.uk</Username<Passwordjemima79</Password<IntegratorKeyIDEB-8ce296aa-0dff-4347-8ece-b62836a6a94e</IntegratorKey</DocuSignCredentials"
Dim x As New OperationContextScope(DocuSignSoap.InnerChannel)
Dim httpRequest As New System.ServiceModel.Channels.HttpRequestMessageProperty
httpRequest.Headers.Add("X-DocuSign-Authentication", strAuth)
OperationContext.Current.OutgoingMessageProperties(httpRequest.Name) = httpRequest
' Create the envelope on the account -- it will be a draft
DocuSignEnvelopeStatus = DocuSignSoap.CreateAndSendEnvelope(DocuSignEnvelope)
buffer = Nothing
Mystream = Nothing
httpRequest = Nothing
I would suggest the following:
Try adding your custom fields without the use of anchor tabs (i.e. use absolute positioning)
Compare how you are configuring your custom fields with the sample code from the SOAP SDK up on GitHub.
Create the envelope using the newer REST API from DocuSign.

Add a Parameter Value in SSRS

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