So I can't reference any specific SSRS web service with my project because I want users to be able to point it to their own report server. Is there any way for me to do this?
Specifically I'm going to need to be able to (at least) get the available reports, view reports, and schedule reporting. I haven't touched report scheduling via c# yet, but report selection/viewing is simple enough with a reference to my local reporting service. Is there any way to dynamically load the web service for any given reporting service--assuming I know the url or the server and instance name?
var rs = new ReportingService2005
{
Credentials = System.Net.CredentialCache.DefaultCredentials
};
// get catalog items from the report server database
CatalogItem[] items = rs.ListChildren("/", true);
// add each report to the combobox
foreach (CatalogItem ci in items)
{
if (ci.Type == ItemTypeEnum.Report)
comboBox1.Items.Add(ci.Path);
}
This is what I'm currently doing to pull out the available reports. But, as mentioned, above, it is directly referencing my own report server. ReportingService2005 (what I named the reference to my .asmx web service) is what I would like to be able to dynamically load.
Definitely possible. ReportingServices have .Url property you can assign. So you can do:
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx";
Reference: "Setting the Url Property of the Web Service"
Related
I have multilingual sites on my SharePoint 2013 server (on-premise) and I would like to retrieve localized sites and lists name via the .NET Managed API (CSOM) in C#.
I tried to use the "TitleResource" property object from Web object and its GetValueForUICulture() method :
var web = spContext.Web;
var webTitleRes = web.TitleResource;
var webFrenchTitle = webTitleRes.GetValueForUICulture("fr").Value;
spContext.ExecuteQuery();
But it crashes at the last line saying that this field/property doesn't exist:
I previously tried to update the Web's "LocaleID" value as it is showed in a sample app from the Office PnP project : check here
But the server throw an Exception, saying that I don't have enough permission to do that :
Well, I don't really want to update the LocaleID on the server, I just want to locally retrieve localized titles so it seems to be a completely wrong way.
How can I retrieve localized title's string from my SharePoint server? What am I missing?
Update
For reference, it seems that TitleResource and DescriptionResource attributes are only accessible from the "online" version of SharePoint, yet the MSDN doc doesn't mention anything about that, leading to a improper use of these :
It may be usable in the brand new 2016 version, btw. We'll see.
the UiCulture should be a Culture object.
Try this:
blablabla.GetValueForUICulture(new CultureInfo(1036)).Value;
I am trying to learn how to use the Telerik Reporting dll and i cannot find a single solid example that explains setup from start to finish for wanting to render a report that is located on an ssrs server. I am trying to set it up just like the normal windows reportviewer control( i know they're not the same). I have researched trying to set the server, report path, credentials, and so forth to simply connect and find the report to render but there is not one damn example...Can someone please share the secret to get this method working? The below code worked perfectly with the windows reportviewer control but i can't find an example for the telerik one that comes close to these properties for setup.
ServerReport serverReport = rvMain.ServerReport;
//User Credentials
System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;
ReportServerCredentials rptServerCrecentials = serverReport.ReportServerCredentials;
rptServerCrecentials.NetworkCredentials = credentials;
serverReport.ReportServerUrl = new Uri(report.ReportServer);
serverReport.ReportPath = report.ReportPath;
//EnableExportFormats(report.ExportTypes);
//Render the report
rvMain.RefreshReport();
Telerik Reporting does not support opening SSRS reports - this is the reason why you are having troubles. It can only open reports created with the Telerik report designers.
Cheers.
Today, for each customer, we deploy same SSRS reports folder and data source folder.
The difference between these folders are the name of each folder and the connection string of the data source.
We are using Report Server 2008 R2.
Is it possible to maintain only one reports and data source folder and change programmatically its connection string on server-side before the report been rendered?
If not, Is it something that can be achieved by changing some logic in reports?
Today we use "shared data source" option.
This is something we've done in our environment - we maintain one set of reports that can be deployed at any client with their own configuration.
You've got a couple of options here. Since you're using a Shared Data Source this makes things easier as you won't need to define a Data Source for each report.
1. Use the rs.exe utility and a script file
rs.exe at Books Online
This program allows you to create script files (in VB.NET) that can interact with a Report Server Web Service. You create a script file (e.g. Deploy.rss) and call the rs.exe program with various parameters, including any custom ones you define:
rs.exe -i DeployReports.rss -s http://server/ReportServer -v DatabaseInstance="SQL" -v DatabaseName="ReportDB" -v ReportFolder="ClientReports"
So this would call a script DeployReports.rss, connect to http://server/ReportServer, with three user defined parameters which could be used to create a data source and the report folder.
In the scipt file you could have something like this:
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
CreateFolder(reportFolder, "Report folder")
CreateFolder(datasourceFolder, "Data source folder")
CreateDataSource()
End Sub
Which can then make Web Service calls like:
rs.CreateFolder(folderName, "/", Nothing)
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = "data source=" + DatabaseInstance + ";initial catalog=" + DatabaseName
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(datasource, datasourcePath, False, definition, Nothing)
Console.WriteLine("Data source {0} created successfully", datasource)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
You haven't specified what version of Reporting Services you're using, so I'm assuming 2008. Please note that there are multiple endpoints that can be used, depending on SQL Server version. The 2005/2008 end point is deprecated in 2008R2 and above but is still usable. Just something to bear in mind when writing your script.
2. Call the SSRS Web Service through an application
Report Server Web Service overview
The same calls that are made from the script above can be made in any other application, too. So you'd just need to add a reference to a Report Server Web Service through WSDL and you can connect to a remote service and call its methods to deploy reports, data sources, etc.
So ultimately you're connecting to the Report Server Web Service, it's just the medium used that you need to think about.
Using a script is easier to get running as it's just running a program from the command line, but writing your own deployment application will certainly give greater flexibility. I would recommend getting the script going, so you understand the process, then migrate this to a bespoke application if required. Good luck!
You can use an Expression Based Connection String to select the correct database. You can base this on a parameter your application passes in, or the UserId global variable. I do believe you need to configure the unattended execution account for this to work.
Note: be careful about the security implications. Realize that if you would pass sensitive data (e.g. passwords) into a parameter, that (a) it will go over the wire, and (b) will be stored in the execution log tables for reporting services.
i have made window application, which checks new announcements on sharepoint 2007 site, if any new announcemnt is found it shows it as link in my win application.
application is running fine on my server machine, but when i try to run my window application from normal machine it gives me:
System.IO.FileNotFoundException: The
Web application at
http://Server-Name:Port-Num/lists/announcements/Allitems.aspx could not be found. Verify that you
have typed the URL correctly. If the
URL should be serving existing
content, the system administrator may
need to add a new request URL mapping
to the intended application.
this machine exists on LAN, as i can access site from my browser, but when it comes to win application it gives me the above error on following line:
string rawurl = "http://192.168.1.105:1625/";
SPSite site = new SPSite(rawurl); // this line gives error
It should throw an exception because the Server Object Model you are using like SPSite, SPWeb will not work unless it's on the server either web application or windows application.
If you want to get data from a remote sharepoint server you should use SharePoint Web Services.
This article will help you http://www.infoq.com/articles/swanson-moss-web-services
References:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/570a4734-d11e-4385-bb97-8625013ebe99/
http://objectmix.com/sharepoint/296959-object-model-new-web-site-creation-remote-sharepoint-server.html
make sure the alternate access mapping is correctly set
so if you can call a page with multiple name (machine name and alias like xxxx73 and portauat) note that may only one works in visual studio so try to fix mapping in central admin or call the page with default main url.
for me noting this small tip, fix my problem in my Sharepoint 2010 UAT environment
I've got a bunch of reports deployed as RDL's to a SSRS. Because of high security requirements, the db passwords change very frequently. It's become a huge task to keep up with the changes and having to modify dozens upon dozens of reports. This leads to my question...
Is it possible to programmatically set a data source or a connection string for a deployed report?
Could this be done using an app that modifies something in the report itself as it sits on the server?
Could this be done by modifying a shared data source from an app as the DS sits on the server?
Could it be done by embedding a script inside the report itself which retrieves the connection from say a web service?
Thanks
This can be done in multiple ways, I think one of the simplest is using the API of SSRS web service. The web service lets you manipulate all the reporting entities including the Data Sources.
As a solution to this issue it's possible to update the data sources credentials using calls to the web service every time the DB password changes (even automate it using some sort of trigger?).
I did something similar in a project where RDLs and data sources had to be generated, deployed and manipulated in runtime and it worked fine so updating data source must be feasible.
Add a Service Reference to your project for your Reporting Service endpoint(http://ReportServerHost.mydomain.tld/ReportServer/ReportService2005.asmx). Use the following code to modify the Data Source password:
public static void ChangeDataSourcePassword(string dataSourcePath, string password)
{
using (ReportingService2005SoapClient reportingService = new ReportingService2005SoapClient())
{
reportingService.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
try
{
ServerInfoHeader serverInfo = null;
DataSourceDefinition dataSourceDefinition = null;
serverInfo = reportingService.GetDataSourceContents(dataSourcePath, out dataSourceDefinition);
dataSourceDefinition.Password = password;
serverInfo = reportingService.SetDataSourceContents(null, dataSourcePath, dataSourceDefinition);
}
catch (FaultException ex)
{
// Do something with the exception. Rethrow it and/or show it to the user.
Console.WriteLine(string.Format("Failed to change the password on {0}: {1}", dataSourcePath, ex.Message));
throw new ApplicationException("Failed to change the password on the Data Source.", ex);
}
}
}