public void DataSourceExportFailEventHandler(SSRSExport sender, DataSourceExportFailEvent e)
        {
            string sPath = e.GetSSRSPath();

            Console.WriteLine(string.Format("Failed to export data source {0}: {1}", sPath, e.GetErrorMessage()));

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

                oDebugForm.LogMessage(sMsg, e.GetException());
            }
        }
        public void ExportDataSources()
        {
            string SSRSPath = this.mSSRSPath;
            string ExportPath = this.mExportPath;
            List<string> DataSourcesExportedList = 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.");

            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;

                    try
                    {
                        if (sItemType == "DataSource")
                        {
                            string sDataSourceExportPath = string.Format("{0}{1}.json", ExportPath, oItem.Path.Replace('/', '\\'));

                            // Call DataSourceFoundEventHandler
                            DataSourceFoundEvent oDataSourceFoundEvent = new DataSourceFoundEvent();
                            oDataSourceFoundEvent.SetSSRSPath(oItem.Path);
                            DataSourceFound(this, oDataSourceFoundEvent);

                            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)
                    {
                        DataSourceExportFailEvent oDataSourceFailEvent = new DataSourceExportFailEvent();
                        oDataSourceFailEvent.SetException(er);
                        oDataSourceFailEvent.SetErrorMessage(er.Message);
                        oDataSourceFailEvent.SetSSRSPath(oItem.Path);
                        oDataSourceFailEvent.SetExportedPath(ExportPath);

                        DataSourceExportFail(this, oDataSourceFailEvent);
                    }
                }
            }
            catch (Exception er)
            {
                throw new Exception(string.Format("Failed to export data sources: {0}", er.Message));
            }
        }