Download power BI dashboard programmatically - vb.net

I am trying to write a VB code to export Power BI dashboard from PowerBI server to local path using script task in SSIS using HTTP Connection Manager. A 5KB file is getting generated but not able to open it. Could anyone help me to fix this up.
Dim HttpCon As ConnectionManager = Dts.Connections("ReportServer")
Dim ClientCon As HttpClientConnection = New HttpClientConnection(HttpCon.AcquireConnection(Nothing))
Dim ReportFileName As String = "C:\localpath\Warranty.pdf"
ClientCon.ServerURL = "http://powerbidev.abc.com/Reports/powerbi/FolderName/&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False"
ClientCon.DownloadFile(ReportFileName, True)

You can use Power BI API (link to request you need) to accomplish it.
There should be a programmatic authnetication first, but it is a whole new topic.
Also, there are nu-get package to do it, but you will got problems with adding additional ddls to Script task, when deploying package to server.

Related

Uipath automation

I want to take the report of last one download details from the mysql database and sent to my project manager on every monday through the email so the process remains same only date would be change dynamically so, I would like to automate this process using RPA UIpath.
Anyone could you help me to achieve this process.
Thanks
Use 'Database' package to connect to sql db and and run the query.
Schedule the program to run every Monday using Orchestrator.
Create the report with current date using DateTime function
There will be some extra steps like transforming data as necessary etc, but the basic outline of this process is as follows
Download MySQL ODBC Drivers MySQL site
Control Panel -> Setup ODBC Data Sources (32-bit) setup User or System DSN, make sure to test your connection to see if it works OK (it's similar to how you set it up in MySQL Workbench or read about it here)
In your UiPath Studio Package Manager, add Database Activities Pack.
Get your data using UiPath.Database.Activities.ExecuteQuery activity to a DataTable
Write your data to an Excel file using Write Range activity
Send your mail through SMTP using UiPath.Mail.SMTP.Activities.SendMail including freshly created Excel file as attachment
First step Take the data using database activity
Create an automation in UiPath to attach and send to your respective email
Schedule it own orchestrator.
Though not exactly but atleast sending a mail by taking credential from Orchestrator is shown in this article
https://www.c-sharpcorner.com/article/create-a-sequence-project-for-sending-a-mail-using-smtp-activity-by-taking-crede/

Change Database-Name/Server at runtime

I am using Visual Studios build-in DataSource functions, to work with my application and its database. Now I am facing one little problem; How do I change the database-server in the final project?
Obviously the end-users server name will not be the same as mine.
Also how can I change it at runtime? My application has functions to find the database-server itself, so it needs to be able to change the database server at runtime (Only at applcations start) .
Update 1:
Right now I am Changing my TableAdapter.Connection.ConnectionString with .Replace("My Local Server Name", "New Server Name") to change the Server. But I don't think that's the way it's supposed to be done.
If you want to change the connection string after deployment then you edit the config file by hand or you can do so in code if the current user is an administrator.
If you want to change the connection string for a table adapter at run time to something other than what's in the config file then you do indeed need to set the Connection.ConnectionString property. The most advisable way to do that is to use a connection string builder. For an Access database, that might look like this:
Dim builder As New OleDbConnectionStringBuilder(myTableAdapter.Connection.ConnectionString)
builder.DataSource = dataSourceName
myTableAdapter.Connection.ConnectionString = builder.ConnectionString

Connecting to Azure SQL database from "Execute R Script" module in "Azure Machine Learning Studio"

I have already set up an Azure SQL Database and loaded results into it form my local machine via R (RODBC) successfully. I can do queries in R Studio with no problem.
However when I use the same code in Execute R script module in the ML studio, I get an error that the connection is not open.
What do I need to change? Have tried different strings for the driver with no avail.
The reason Reader or Import Data module is not working for my case is that I am creating an API that provides me with the information to query the database before doing analytics. The database is very big and I do not want to load whole table and then use project columns, etc.
Any help is really appreciated
Thanks all
RODBC in Execute R Script is not supported. You can use an Import Data (aka. Reader) module, and mark the query string as a web service parameter, if you need to dynamically inject the query.

Use ReportingService API to read custom data source credentials

We have an SQL 2008 R2 server running reporting services and I would like to identify reports that use specific credentials to connect to a data source. In this situation, the reports connect to the data source using a custom data source with a specific user account that has the proper security on the SQL server to run the reports.
Plan plan was to query [ReportServer].[dbo].[Catalog] to get a list of reports. Then run it through the code below to identify the reports using credentials I'm interested in. All of this would be done in an SSIS package.
Using the ReportingService API, I can read the user name of the credentials in the connection strings of shared data sources. The code is listed below. However, in my case, I need to load the data source credentials from a custom data source specific to the report, not a shared data sources. The GetDataSourceContents method doesn't seem to support this. If I supply the report name & path instead of the shared data source, it generates an error.
Is there another way to approach this? We have hundreds of reports, so using the UI to look this information up would be impractical.
Thanks in advance.
NOTE: "web_service" is the web service reference to the report server (http://[servername]/ReportServer/ReportService2005.asmx?WSDL)
Dim rs As New web_service.ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim ds_def As web_service.DataSourceDefinition
ds_def = rs.GetDataSourceContents("/Data Sources/data_source_1")
With MyCredentialsOutputBuffer
.AddRow()
.UserName = ds_def.UserName
End With
You will need to pull down the rdl content and parse it:(
Embedded data source information is stored in the .rdl and not a shared data set item obtained via the api. Even then you can't retrieve data source passwords.

How to connect to TFS using VB

I'm writing an application that needs to connect to the Team Foundation Server, and then get the last version of a specific file from a specific project. At the begging I did this by using an external .bat, but I'd preffer running eveything inside the code.
I've been looking for examples but all I can find is written in C#. All I got so far is:
Dim tfs As TeamFoundationServer = New TeamFoundationServer(nameOfServer)
Thanks!
Finally I manage to solve it:
Dim tfs As TeamFoundationServer = New TeamFoundationServer(serverAddress)
Dim vcs As VersionControlServer = tfs.GetService(Of VersionControlServer)()
vcs.DownloadFile(fileToGet, fileDestination)