SSRS - Obtaining the physical report files - reporting-services

Basically I have a reports server which contains loads of "My Reports" reports which I need to migrate to a new SSRS server.
Question:
Is their an easy way to obtain all the physical.RDL files without having to export the files one-by-one from the old server interface and then upload using the new servers interface?
Looking forward to your reply
Steven

There is a third party tool available here that will allow you to batch download / upload rdls.
http://sqldbatips.com/showarticle.asp?ID=62

You could write a small .NET app to retrieve them all, using the SSRS Web Service API. The article on the GetItemDefinition method has sample code to get a single file, here's a relevant snippet (copy/paste alert!):
ReportingService2010 rs = new ReportingService2010();
rs.Url = "http://<Server Name>/_vti_bin/ReportServer/ReportService2010.asmx";
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string reportName = "http://<Server Name>/Docs/Documents"
+ "/AdventureWorks Sample Reports/Sales Order Detail.rdl";
byte[] reportDefinition = null;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
try
{
reportDefinition = rs.GetItemDefinition(reportName);
MemoryStream stream = new MemoryStream(reportDefinition);
string myDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
doc.Load(stream);
doc.Save(Path.Combine(myDocumentsFolder, "Sales Order Detail.rdl"));
}
If you write a little loop around (part of) this code you may be able to quickly grab all the files.

Related

Does Outlook web add-in access to .msg file

My previous VSTO can output the .msg file. But can this be achieved in the new web add-in?
Any code examples?
I am currently using office.js in the front end and EWS managed API in the back end.
Instruction
I have found the above post saying something about that but I cannot integrate into my back end.
Turns out I need to get the itemID first to get the EmailMessage .
ExchangeService service = new ExchangeService();
service.Url = new Uri(ewsUrl);
service.Credentials = new OAuthCredentials(ewsToken);
EmailMessage em = EmailMessage.Bind(service, new ItemId(itemID));
I can use Office.js from the front end to gather those prerequisite info(ewsUrl,ewsTokenitemID)
At this point I can just load the eml by
email.Load(new PropertySet(ItemSchema.MimeContent));
MimeContent mimcon = email.MimeContent;

SSRS -External image not rendering on HTML report

I am working on SSRS Report. I have a report with an external image embedded in it
This renders fine inside the report viewer.
but when I render report in HTML 4.0 format in my application via web url (without using report viewer).The report that comes back from all the data except the image is not in the html
see the image tag looks like the following:-
<img onerror="this.errored=true;" class="r1" src="http://ges-server-pc/ReportServer_SQLEXPRESS?%2FGES-MVC%2FGES_FWCR&rs%3ASessionID=vdpuofii3xtph545xelnym45&rs%3AFormat=HTML4.0&rs%3AImageID=1403af250c474da8a5f851b63a8a377b">
how can I render extrenal image on Report which is in format= HTML 4.0
Can Anybody have solution for the same It will be appreciable
Thanks in advance
Here is one way to ensure that your application can reliably display images dynamic rendered in a report by SSRS.
When you are using the report viewer control, a lot is done behind the scenes to keep an active session and allow access to all artifacts generated by reports requested by the user. When you are using the ReportExecution api directly there are some advanced reporting features that are just not supported. Interactive sorting, sizing, drilldown and this issue just to name a few.
Always ensuring dynamic images from reports are available to your client is pretty easy. I had to cross this hurdle a way back and I'll share the way I solved it.
In a nutshell, you are going to have to intercept the render, iterate the streams, and save each resource to a temp folder and tell ssrs to look for the image in your temp folder that is behind the web app that your end user has authenticated with.
DeviceInfo
The device info structure, mostly overlooked, is going to come in handy. In this structure you will find a StreamRoot property. You can find documents on this. It basically allows you to override the location from which SSRS will stream resources as needed. This is how you tell SSRS to look for your external images in a new location.
For each report rendered I create a temp folder using a guid prior to rendering. Also, prior to rendering you need to set the StreamRoot to this temp folder.
string physicalTempFolder = MakeNewTempFolderInTempOffOfWebRoot();
string virtualTempFolder = Path.Combine(yourWebRoot,"Temp",Path.GetDirectoryName(physicalTempFolder));
Now you have a physical and virtual pointer to your repo where the images will be saved for your report. Now update the StreamRoot in SSRS. This tells SSRS that we want to override the default location for dynamic images and whatnot.
StringBuilder devInfo = new StringBuilder();
if (YourRenderFormat=="HTML")
{
devInfo.Append("<DeviceInfo>");
devInfo.Append("<StreamRoot>" + virtualTempFolder+ "</StreamRoot>");
devInfo.Append("</DeviceInfo>");
}
With the needed device info structure build we can pass it into the render method.
string extension;
string mimeType;
string reportEncoding;
string[] streamIDs = null;
ReportExecution2005.Warning[] warnings = null;
ReportExecution2005.ExecutionHeader execHeader = new ReportExecution2005.ExecutionHeader();
ReportExecution2005.ExecutionInfo rpt = _execService.LoadReport(YourReportPath, null);
if(YourParamas!=null)
_execService.SetExecutionParameters(YourParams, "en-us");
_execService.ExecutionHeaderValue = execHeader;
_execService.ExecutionHeaderValue.ExecutionID = rpt.ExecutionID;
result = _execService.Render(format, devInfo.ToString(), out extension, out mimeType, out reportEncoding, out warnings, out streamIDs);
The render method returns the streamIDs out parameter and it is key here. Next after we call render, simply iterate all the streams that are images and call ssrs's RenderStream() method to get the images and save to your physical temp folder.
if (YourRenderFormat=="HTML"))
{
string imageEncoding = "";
// For each image stream returned by the call to render,
// render the stream and save it to the application root
string FilePath = physicalTempFolder;
byte[] image;
// For each image stream returned by the call to render,
// render the stream and save it to the application root
foreach (string streamID in streamIDs)
{
image = _execService.RenderStream("HTML4.0", streamID, null, out imageEncoding, out mimeType);
//All files are unique
File.WriteAllBytes(Path.Combine(physicalTempFolder,streamID),image);
}
}
return result;

Adding DestinationConnectionOLEDB in subject of SSIS send email task

We have a package on Server A which we use to load the data into different databases on different Servers. We just change the destination Connection through "SQL Server 2008 Integration Services Package Execution Utility". When the package loads the data it sends a confirmation Email with a subject of "package name and time" that data has been loaded successfully. I want to add the destination connection (Server name and database name) in the subject to make sure the data is loading into the right destination.
Any help is greatly appreciated.
The easiest way to do this would be to use a script task to load the information into a variable.
I am assuming that if you are dynamically setting your connection that you have the connection string stored as a variable.
If so you can use the SqlConnectionStringBuilder() class in .net.
var connstring = DTS.Variables["Yourvariablehere"].Value.ToString();
var builder = new SqlConnectionStringBuilder(connstring);
DTS.Variables["servervariablehere"].Value = builder.DataSource;
DTS.Variables["databasevariablehere"].Value = builder.InitialCatalog;

how to load and edit a sql database from adobe flex builder 4.6 air program

Alright I have my sqldb hosted online and can access it using phpmyadmin what i would like to do is create tables and add items to the tables via adobe flex builder 4.6 desktop AIR application.
Anyone know if i am able to do this, the idea for the program is so person at position A can enter a name and person at position B can then use his program to read those names
According to Accessing mysql from Adobe flex/AIR, AIR is unable to access MySQL servers directly, so you'll have to use web services or some custom API do to this. But yeah, sure it's possible to do what you want.
I agree with Isaac. However, I want to add that it is good coding practices to not allow client side applications modify a database directly. In the applications that I have built, I like to use PHP to set-up an API that then interacts with the database. The AIR application then the interaction with the API using HTTP Requests.
Following code shows how to perform a URL request from the Adobe Website.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html
var url:String = url location of the API;
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables(); //create variables to pass to the API
variables.exampleSessionId = new Date().getTime(); //create variables to pass to the API
variables.exampleUserLabel = "guest"; //create variables to pass to the API
request.data = variables; //Add the variables to the request
request.method = URLRequestMethod.POST; //Set the method of the Request GET, POST, PUT
navigateToURL(request); //Executes the request
You'd probably like something like https://backendless.com/ for this.

Using TeamCity to deploy SSRS 2008 R2 Reporting Projects

We are looking to integrate our SSRS 2008 R2 projects into our automated build process. Currently three times a week TeamCity builds and deploys our C# codebase. We'd like to add the SSRS report projects to that. The RDL files are currently in a Subversion source control repository.
You can use Report Server Web Service for this purpose. It has CreateItem method that uploads report to Reporting Service.
To created C# project that uploads rdl files you will need to create proxy class for your ReportService2010.asmx endpoint and then use is it like this:
ReportingService2010 reportingService = new ReportingService2010();
reportingService.Url = url + "/ReportService2010.asmx";
reportingService.Credentials = new System.Net.NetworkCredential(username, password, domain);
Microsoft.SqlServer.ReportingServices2010.Warning[] warnings = null;
using (FileStream reportStream = new FileStream("c:\\report.rdl",
FileMode.Open, FileAccess.Read))
{
using (MemoryStream ms = new MemoryStream())
{
reportStream.CopyTo(ms);
CatalogItem report = reportingService.CreateCatalogItem(
"Report",
"Report1",
"/",
true,
ms.ToArray(),
null,
out warnings);
}
}