Thursday, July 31, 2008

Emailing from a Web Page

Imports System.Net.Mail

'Create an instance of the MailMessage class
Dim objMM As New MailMessage()
Dim Requestor_DropDownList As DropDownList
Dim IssueID_Label As Label

With Issue_FormView   Requestor_DropDownList = .FindControl("RequestedBy_DropDownList")
   IssueID_Label = .FindControl("JobID_Label")
End With

'Set the properties
objMM.To.Add(Requestor_DropDownList.SelectedValue + "")
objMM.From = New MailAddress("")

'Send the email in html format
objMM.IsBodyHtml = True

'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal

'Set the subject
objMM.Subject = "Feedback"

'Set the body
Dim sb As New StringBuildersb.AppendLine("Kiaora " + Requestor_DropDownList.SelectedItem.Text)
sb.AppendLine("Your EST Issue is about to be closed.")
sb.AppendLine("Please take 5 minutes to rate the service you have received the the Enterprise Service Team.")
sb.AppendLine("Click into this link: http://wstProdIIS/EST/register/Issue.aspx?ID=" + IssueID_Label.Text)
objMM.Body = sb.ToString

'Now, to send the message, use the Send method of the SmtpClient class
Dim objSC = New SmtpClient
objSC.Host = ""

Wednesday, July 30, 2008

Some extra Reporting Service Parameters

<rsweb:ReportViewer ID="rptLetter" runat="server" ExportContentDisposition="AlwaysAttachment" 
       Height="475px" ProcessingMode="Remote" PromptAreaCollapsed="true"
       ShowPromptAreaButton="false" SizeToReportContent="True" Width="100%" ShowFindControls="false"
        <ServerReport ReportPath="/Reports/Letter" ReportServerUrl="https://reportserver" />

  Dim MyDate As New ReportParameter("date", PrintDate)
  Dim p() As ReportParameter = {MyDate}

  rptLetter.ServerReport.ReportPath = "/Reports/" & ReportName
  rptLetter.ServerReport.ReportServerCredentials = New ReportViewerCredentials(
       "username", "password", "domain")
  rptLetter.Visible = True