While the specifics will vary, this scenario typically involves generating reports on some area of business interest and then sending those reports to recipients of interest. Whether you have an advanced technical degree or just use the computer for day-to-day tasks, it isn’t too hard to make the computer your personal assistant.For this article, let’s focus on a specific type of task that is common for many professionals: sending out reports. Computers can perform painstaking, mundane tasks in a matter of seconds, leaving you the extra time to work on a multitude of more mentally intensive jobs.These are only two possible scenarios where you need to push reports to others rather than (or in addition to) having them pull their own.An additional constraint, though, is that your report recipients must all be separated from each other. Sharing that information is just part of the service that you provide, so it wouldn’t be appropriate to offload such a task to your customers. Or you might be in sales or services and need to share reports with your customers. For instance, your users may be executives who don’t have the time for managing their own reporting.
Developer Add-On Outlook Free Resources ThatIf you need the basics, check out some of the free resources that are available. Every information professional will benefit from some basic scripting ability in a language like PowerShell, and I highly recommend setting aside some time to learn this useful practical skill. For this article, I am assuming that the reports come from a reporting tool that allows email subscriptions, like SQL Server Reporting Services (SSRS), that Outlook is the email client, and some basic PowerShell knowledge.By the way, you don’t have to be a seasoned developer in order to pull this off anyone with a little PowerShell experience can benefit. Wouldn’t it be nice to have the computer be your personal assistant and take care of all that for you?Our goal in this article is to automate the download of periodic reports, associated processing, and dissemination to recipients via discrete outgoing messages with relevant attachments. This constraint adds some complexity and work to the process. One customer should not see or even be aware of other customers’ reports for privacy reasons.Since PDF is the most common file type for this sort of scenario, we will assume the reports are delivered in PDF format for the rest of this article. It is quite simple and involves just pre-selecting the filters of interest and a delivery schedule – for instance, once a month or once a week, etc.When you set up your subscription, be sure to select the type of report that you wish to distribute. Of course, it’s possible to run them manually and save them off, and there’s a solution for automating those, too (though that is outside the scope of this article), but it is much easier to have them come to you.Oftentimes, people are not aware that you can automate report delivery in SSRS. Report DeliveryA key component of this solution is that the reports you need to send out are delivered to your inbox. This will make the script easier to code, and it will enable easier management as things change over time.For instance, our example here assumes customer recipients. As you can see in the image below, you create a group for each type of recipient for each destination. In our case, we will use Outlook groups to refer to recipients as a group rather than by name. Instead of doing that, let’s add a layer of abstraction to the process. Paragon ntfs for macTemplate EmailsWe also need a template email. As contacts change, all you need to do is keep these groups up to date, and the automation script will implicitly pick those changes up without any need to modify the code. That could be one person or a lot of people. For each group, then, you simply add the actual people who will need to receive the reports. Check out how to make groups in Outlook HERE. For example: ( CompanyName)( ReportTitle)( Date).pdf I like to rename each PDF with something meaningful to the recipient and report. Open the emails and save the PDF to the proper folder in your filing system for backup purposes. Automation ProcessOnce the reports of interest show up in your inbox at the designated time from SSRS, our automation will follow these steps: Setting up an organized filing system is key to keeping the files organized and easy to locate in the future. To create an email template, go HERE.In this optional but recommended step, organize your folder structure so that you can save a copy of each report automatically for your records. Next, we expand the contact groups specified in the To and CC lines of the new email. Here is the code, which you can just copy and paste:$inbox = $namespace.GetDefaultFolder(::olFolderInbox)$emails = $inbox.Items | Where-Object $ccListFinal = $ccListFinal.Substring(0, $ccListFinal.Length - 1) # Trim final # Customize the rest of the message as needed$emailToCustomer.Attachments.Add($fileFullPath) | Out-Null$emailToCustomer.HTMLBody = $emailToCustomer.HTMLBody.Replace("", $priorMonth)$emailToCustomer.HTMLBody = $emailToCustomer.HTMLBody.Replace("", $priorYear)As you can see, we first use a template denoted by the constant $emailTemplatePattern for each recipient or customer to create a new email. This also means that you could modify this code to control other Office products like Word or Excel. That means that any functionality exposed by the framework can be accessed by PowerShell. NET framework available to us. We are taking advantage of the fact that PowerShell makes the entire. You could also parse information out of the attachments themselves, though such an activity is beyond the scope of this article. This data is usually pulled directly off of the title or file name of the reports sent by SSRS.
0 Comments
Leave a Reply. |
Details
AuthorKyle ArchivesCategories |