Ejemplo n.º 1
0
 private static void GetHeaders(string UserName, string UserPassword, ReportingService2010.ReportingService2010SoapClient rsService, ReportExecution2005.ReportExecutionServiceSoapClient rsExec, out ReportingService2010.TrustedUserHeader trusteduserHeader, out ReportExecution2005.TrustedUserHeader userHeader)
 {
     rsService.ClientCredentials.SupportInteractive                = false;
     rsService.ClientCredentials.Windows.ClientCredential          = System.Net.CredentialCache.DefaultNetworkCredentials;
     rsService.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
     System.Net.NetworkCredential clientCredentials = new System.Net.NetworkCredential(UserName, UserPassword);
     if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(UserPassword) && UserName != "@UserName" && UserPassword != "@UserPassword")
     {
         rsService.ClientCredentials.Windows.ClientCredential = clientCredentials;
         rsService.ClientCredentials.UserName.UserName        = UserName;
         rsService.ClientCredentials.UserName.UserName        = UserPassword;
     }
     trusteduserHeader          = new ReportingService2010.TrustedUserHeader();
     trusteduserHeader.UserName = clientCredentials.UserName;
     userHeader          = new ReportExecution2005.TrustedUserHeader();
     userHeader.UserName = clientCredentials.UserName;
     if (rsExec != null)
     {
         rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
         //rsExec.ClientCredentials.Windows.ClientCredential = credentials.GetCredential(new Uri(baseUrl), "NTLM");
     }
 }
Ejemplo n.º 2
0
        private void CheckLinkedFolderExists(ReportingService2010.ReportingService2010SoapClient rsService
                                             , ReportingService2010.TrustedUserHeader trusteduserHeader
                                             , ReportingService2010.SearchCondition condition
                                             , ReportingService2010.SearchCondition[] conditions
                                             , string linkedReportFolderPath
                                             )
        {
            string parentFolderPath = @"/";

            string[] folders = linkedReportFolderPath.Split('/');
            for (int i = 0; i < folders.Length; i++)
            {
                if (!string.IsNullOrEmpty(folders[i]))
                {
                    ReportingService2010.CatalogItem[] foundItems = null;
                    condition.Values = new string[] { folders[i] };
                    rsService.FindItems(trusteduserHeader
                                        , parentFolderPath
                                        , ReportingService2010.BooleanOperatorEnum.And
                                        , new ReportingService2010.Property[0]
                                        , conditions
                                        , out foundItems);

                    if (foundItems == null || (foundItems != null && foundItems.Count() == 0))
                    {
                        ReportingService2010.CatalogItem linkedFolder = new ReportingService2010.CatalogItem();
                        rsService.CreateFolder(trusteduserHeader
                                               , folders[i]
                                               , parentFolderPath
                                               , new ReportingService2010.Property[0]
                                               , out linkedFolder
                                               );
                    }
                    parentFolderPath = parentFolderPath.TrimEnd('/') + @"/" + folders[i];
                }
            }
        }
Ejemplo n.º 3
0
 private static void GetHeaders(string UserName, string UserPassword, ReportingService2010.ReportingService2010SoapClient rsService, ReportExecution2005.ReportExecutionServiceSoapClient rsExec, out ReportingService2010.TrustedUserHeader trusteduserHeader, out ReportExecution2005.TrustedUserHeader userHeader)
 {
     rsService.ClientCredentials.SupportInteractive = false;
     rsService.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
     rsService.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
     System.Net.NetworkCredential clientCredentials = new System.Net.NetworkCredential(UserName, UserPassword);
     if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(UserPassword) && UserName != "@UserName" && UserPassword != "@UserPassword")
     {
         rsService.ClientCredentials.Windows.ClientCredential = clientCredentials;
         rsService.ClientCredentials.UserName.UserName = UserName;
         rsService.ClientCredentials.UserName.UserName = UserPassword;
     }
     trusteduserHeader = new ReportingService2010.TrustedUserHeader();
     trusteduserHeader.UserName = clientCredentials.UserName;
     userHeader = new ReportExecution2005.TrustedUserHeader();
     userHeader.UserName = clientCredentials.UserName;
     if (rsExec != null)
     {
         rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
         //rsExec.ClientCredentials.Windows.ClientCredential = credentials.GetCredential(new Uri(baseUrl), "NTLM");
     }
 }