Ejemplo n.º 1
2
        private ValidatedResponse<CatalogItem> GetReportObjectFromSSRS(string reportName)
        {
            CatalogItem catalogItem;
            var client = new ReportingService2010SoapClient();

            try
            {
                // Get EndPoint Address from AppSettings.
                Log.Information("GetReportObjectFromSSRS : Getting the report object {@reportName}", reportName);
                var trustedUserHeader = new RS2010.TrustedUserHeader();
                client.Endpoint.Address = this.reportService2010Reference;
                client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
                client.ClientCredentials.Windows.ClientCredential = null;
                client.Open();

                Log.Information("GetReportObjectFromSSRS : Reporting Service 2010 Soap Client Uri -  {@uri}", this.reportService2010Reference.Uri);
                //// I need to list of children of a specified folder.
                CatalogItem[] items;
                client.ListChildren(trustedUserHeader, "/", true, out items);

                catalogItem = (from CatalogItem ci in items
                         where ci.TypeName.Contains("Report") && ci.Name.Equals(reportName, StringComparison.OrdinalIgnoreCase)
                         select ci).FirstOrDefault();

                Log.Information("GetReportObjectFromSSRS : Catalog Item {@catalogItem} was successfully obtained", catalogItem.Name);

                Log.Information("GetReportObjectFromSSRS : Successfully obtained Report Object"); 
                return ValidatedResponse<CatalogItem>.Success(catalogItem);

            }
            catch (Exception ex)
            {
                Log.Error(ex, "GetReportObjectFromSSRS: Something went wrong in getting the SSRS Report Object - {@reportname}", reportName);
                return ValidatedResponseHelper.Failure<CatalogItem>("Error {0}", ex.ToString());
            }
            finally
            {
                client.Close();
            }

        }
Ejemplo n.º 2
0
        public List <(string name, string path)> GetAllReports()
        {
            var childrenResponse = reportingServicesClient.ListChildren(new ListChildrenRequest {
                ItemPath = "/", Recursive = true
            });

            return(childrenResponse.CatalogItems.Select(x => (x.Name, x.Path)).ToList());
        }
        private void test_1()
        {
            NetworkCredential clientCredentials = new NetworkCredential("Chathuranga", "blahhhhh", "Chathu-Nable");


            ReportingService2010SoapClient client = new ReportingService2010SoapClient();

            client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            client.ClientCredentials.Windows.ClientCredential          = clientCredentials;



            client.Open();
            TrustedUserHeader t = new TrustedUserHeader();



            CatalogItem[] items;
            // I need to list of children of a specified folder.
            ServerInfoHeader oServerInfoHeader = client.ListChildren(t, "/", true, out items);

            foreach (var item in items)
            {
                // I can access any properties of item
                Console.WriteLine(item.ID);
            }

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public CatalogItem[] ListReportCollection(string itemPath, bool recursive)
        {
            CatalogItem[] reportCollection = { };

            try
            {
                ReportingService2010SoapClient client = new ReportingService2010SoapClient();

                //NT LAN Manager (NTLM) is a suite of Microsoft security protocols that provides authentication, integrity, and confidentiality to users.[1][2][3] NTLM is the successor to the authentication protocol in Microsoft LAN Manager (LANMAN),
                client.ClientCredentials.Windows.AllowNtlm        = true;
                client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

                //
                // Summary:
                //     The server process can impersonate the client's security context on its local
                //     system. The server cannot impersonate the client on remote systems.
                //  Impersonation = 3,

                //       Finally figure it out.
                //       My Reporting Services were configured to a local account while my Application Pool for IIS was configured to ApplicationPoolIdentity.
                //      I changed my Application Pool to LocalSystem and it fixed it. Hopefully this information will be useful to others as I wasted several hours figuring this out.

                client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

                CatalogItem aCatalogItem = new CatalogItem();


                // aCatalogItem.TypeName

                // Summary:
                //     The server process can impersonate the client's security context on remote
                //     systems.
                // client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

                client.Open();
                TrustedUserHeader t = new TrustedUserHeader();

                try
                {
                    // I need to list of children of a specified folder.
                    client.ListChildren(t, itemPath, recursive, out reportCollection); // see http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.listchildren.aspx
                }
                catch (SoapException ex)
                {
                    // _logger.Error("ReportServerManagementService--" + ex);
                }
            }
            catch (SoapException ex)
            {
                // _logger.Error("ReportServerManagementService--" + ex);
            }

            return(reportCollection);
        }
        public List <CatalogItem> GetReportHierarchy()
        {
            List <ReportItem> liReportItems = new List <ReportItem>();

            CatalogItem[] catalogItems = null;
            serviceClient.ListChildren(userHeader, "/", true, out catalogItems);

            if (catalogItems != null)
            {
                return(catalogItems.ToList());
            }

            return(null);
        }
        public void Download(string targetServerUri, string artifactsFolderPath)
        {
            bool isHttpsEndpoint = new Uri(targetServerUri).Scheme == Uri.UriSchemeHttps;

            outputFolderPath = artifactsFolderPath;
            ReportingService2010SoapClient reportingServicesClient = CreateClientProxy(targetServerUri, isHttpsEndpoint);

            var userHeader = new TrustedUserHeader();

            CatalogItem[] items = null;
            reportingServicesClient.ListChildren(userHeader, "/", true, out items);
            DownloadReportDataSources(reportingServicesClient, userHeader, items);
            DownloadSharedDataSets(reportingServicesClient, userHeader, items);
            DownloadReports(reportingServicesClient, userHeader, items);
        }