public void ReportExportFailEventHandler(SSRSExport sender, ReportExportFailEvent e)
        {
            Report oReport = e.GetReport();

            Console.WriteLine(string.Format("Failed to export report {0}: {1}", oReport.Name, e.GetErrorMessage()));

            if (mDebug)
            {
                string sMsg = string.Format("Failed to export report '{0}' to {1}. Path={2}; Exception={3}", oReport.Name, e.GetExportedPath(), oReport.Path, e.GetErrorMessage());

                oDebugForm.LogMessage(sMsg, e.GetException());
            }
        }
        public void ExportReportsFromList()
        {
            string SSRSPath = this.mSSRSPath;
            string ExportPath = this.mExportPath;
            List<string> ReportsList = this.mReportsList;
            List<string> ReportsExportedList = new List<string>();

            if (string.IsNullOrEmpty(SSRSPath))
                throw new ArgumentNullException("Please provide a valid SSRS path for the parent folder.");

            if (string.IsNullOrEmpty(ExportPath))
                throw new ArgumentNullException("Please provide a valid export path.");

            if (mReportsList == null)
                throw new ArgumentNullException("Please provide a valid reports list.");

            try
            {
                if (this.mDefaultCredentials == true)
                    mReportingService.Credentials = CredentialCache.DefaultCredentials;
                else
                    mReportingService.Credentials = new NetworkCredential(this.mUsername, this.mPassword, this.mDomain);

                CatalogItem[] oItems = mReportingService.ListChildren(SSRSPath, this.mRecursiveList);

                foreach (CatalogItem oItem in oItems)
                {
                    string sItemType = oItem.TypeName;
                    Report oReport = this.GetReport(oItem);
                    string sReportExportPath = string.Format("{0}{1}.rdl", ExportPath, oItem.Path.Replace('/', '\\'));

                    try
                    {
                        if (sItemType == "Report")
                        {
                            // Only export the report if its in our list of reports
                            if (ReportsList.Find(r => r == oItem.Path) == null)
                                continue;

                            // Call ReportExportReportFoundEventHandler
                            ReportFoundEvent oReportFoundEvent = new ReportFoundEvent();
                            oReportFoundEvent.SetReport(oReport);
                            ReportFound(this, oReportFoundEvent);

                            byte[] oReportDefinition = null;
                            oReportDefinition = mReportingService.GetItemDefinition(oItem.Path);

                            // Do export
                            this.SaveReport(sReportExportPath, oReportDefinition, true);

                            // Call ReportExportSuccessEventHandler
                            ReportExportSuccessEvent oReportSuccessEvent = new ReportExportSuccessEvent();
                            oReportSuccessEvent.SetExportedPath(sReportExportPath);
                            oReportSuccessEvent.SetReport(oReport);
                            ReportExportedSuccess(this, oReportSuccessEvent);
                        }
                        //else if (sItemType == "DataSource")
                        //{
                        //    // Call DataSourceFoundEventHandler
                        //    DataSourceFoundEvent oDataSourceFoundEvent = new DataSourceFoundEvent();
                        //    oDataSourceFoundEvent.setSSRSPath(oItem.Path);
                        //    DataSourceFound(this, oDataSourceFoundEvent);

                        //    string sDataSourceExportPath = string.Format("{0}{1}.json", ExportPath, oItem.Path.Replace('/', '\\'));
                        //    string output = GetDataSource(oItem.Path);
                        //    SaveDataSource(sDataSourceExportPath, output, true);

                        //    // Call DataSourceExportSuccessEventHandler
                        //    DataSourceExportSuccessEvent oDataSourceSuccessEvent = new DataSourceExportSuccessEvent();
                        //    oDataSourceSuccessEvent.setDataSourceText(output);
                        //    oDataSourceSuccessEvent.setPath(sDataSourceExportPath);
                        //    oDataSourceSuccessEvent.setSSRSPath(oItem.Path);
                        //    DataSourceExportedSuccess(this, oDataSourceSuccessEvent);
                        //}
                    }
                    catch (Exception er)
                    {
                        ReportExportFailEvent oReportFailEvent = new ReportExportFailEvent();
                        oReportFailEvent.SetException(er);
                        oReportFailEvent.SetErrorMessage(er.Message);
                        oReportFailEvent.setReport(oReport);
                        oReportFailEvent.SetExportedPath(sReportExportPath);

                        ReportExportFail(this, oReportFailEvent);
                    }
                }
            }
            catch (Exception er)
            {
                throw new Exception(string.Format("Failed to export reports: {0}", er.Message));
            }
        }