@@ -15,6 +15,7 @@ namespace AnalyzeInExcel
1515 public partial class App : Application
1616 {
1717 public Options AppOptions ;
18+ const string MSOLAP_DRIVER_URL = @"https://go.microsoft.com/fwlink/?LinkId=746283" ;
1819
1920 public void CheckUpdates ( bool synchronous = true )
2021 {
@@ -45,6 +46,10 @@ public MessageBoxResult ShowMessage( string message )
4546 {
4647 return MessageBox . Show ( message , "Analyze in Excel for Power BI Desktop" ) ;
4748 }
49+ public MessageBoxResult ShowMessageQuestion ( string message )
50+ {
51+ return MessageBox . Show ( message , "Analyze in Excel for Power BI Desktop" , MessageBoxButton . YesNo , MessageBoxImage . Question , MessageBoxResult . Yes ) ;
52+ }
4853
4954 protected override void OnStartup ( StartupEventArgs e )
5055 {
@@ -63,7 +68,27 @@ protected override void OnStartup(StartupEventArgs e)
6368 {
6469 string serverName = ( ( App ) Application . Current ) . AppOptions ? . Server ;
6570 string databaseName = ( ( App ) Application . Current ) . AppOptions ? . Database ;
66- string cubeName = ModelHelper . GetModelName ( serverName , databaseName , th ) ;
71+ bool goodMsOlapDriver = ModelHelper . HasMsOlapDriver ( ) ;
72+ if ( ! goodMsOlapDriver )
73+ {
74+ th . TrackEvent ( "MSOLAP driver not found" ) ;
75+ if ( ShowMessageQuestion ( $ "Excel needs a component called MSOLAP driver to connect to Power BI. The MSOLAP driver might be missing or not updated on this device. Therefore, Excel might not connect to Power BI. You can install the updated Microsoft MSOLAP driver from this link: { MSOLAP_DRIVER_URL } \n \n Click YES if you want to download the updated MSOLAP driver and install it.\n Click NO to continue without any update.") == MessageBoxResult . Yes )
76+ {
77+ try
78+ {
79+ th . TrackEvent ( "Requested MSOLAP driver setup" ) ;
80+ UpdateMsOlapDriver ( ) ;
81+ }
82+ catch ( Exception ex )
83+ {
84+ // Send any exception to Telemetry
85+ th . TrackException ( ex ) ;
86+ ShowMessage ( $ "Error running MSOLAP update: { ex . Message } ") ;
87+ }
88+ }
89+ }
90+ // We use the default "Model" string if the MSOLAP driver is not available - if this happens, the previous warning helps understanding possible issues
91+ string cubeName = goodMsOlapDriver ? ModelHelper . GetModelName ( serverName , databaseName , th ) : "Model" ;
6792 if ( serverName != null && databaseName != null )
6893 {
6994 try
@@ -121,6 +146,17 @@ protected override void OnStartup(StartupEventArgs e)
121146 throw ;
122147 }
123148
149+ void UpdateMsOlapDriver ( )
150+ {
151+ var p = new Process
152+ {
153+ StartInfo = new ProcessStartInfo ( MSOLAP_DRIVER_URL )
154+ {
155+ UseShellExecute = true
156+ }
157+ } ;
158+ p . Start ( ) ;
159+ }
124160 }
125161 private void OpenDiagnosticWindow ( string serverName , string databaseName )
126162 {
@@ -141,8 +177,7 @@ Check that the file
141177 private void RunExcelProcess ( string serverName , string databaseName , string cubeName )
142178 {
143179 // Create ODC file
144- OdcHelper . CreateOdcFile ( serverName , databaseName , cubeName ) ;
145- var fileName = OdcHelper . OdcFilePath ( ) ;
180+ var fileName = OdcHelper . CreateOdcFile ( serverName , databaseName , cubeName ) ;
146181
147182 // Open ODC file
148183 var p = new Process
0 commit comments