<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create semantic model with ADO Command, unable to find model afterwards in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Create-semantic-model-with-ADO-Command-unable-to-find-model/m-p/4142100#M55197</link>
    <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/595369"&gt;@Don-Bot&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Regarding your question, you can try the following code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;using (Microsoft.AnalysisServices.Server server = new Microsoft.AnalysisServices.Server())
{
    server.Connect(connectionString);  
    Microsoft.AnalysisServices.Database database = server.Databases.GetByName("adventureworks");
    Microsoft.AnalysisServices.Tabular.Model  model = database.Model as Microsoft.AnalysisServices.Tabular.Model;
}&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here's a screenshot of the response:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vlinyulumsft_0-1725949902114.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1164934iC1862CCE4195B384/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vlinyulumsft_0-1725949902114.png" alt="vlinyulumsft_0-1725949902114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here are the relevant links, I hope you find it helpful:&lt;/P&gt;
&lt;P style="margin: 0in;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://stackoverflow.com/questions/63700003/azure-analysis-service-tabular-model-connecting-to-power-bi-service-netcore-dat" target="_blank"&gt;&lt;SPAN&gt;.net core - Azure Analysis Service Tabular Model connecting to Power BI Service .NetCore Database.Model is null exception - Stack Overflow&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Of course, if you have any new ideas, you are welcome to contact us.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2024 06:31:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-10T06:31:53Z</dc:date>
    <item>
      <title>Create semantic model with ADO Command, unable to find model afterwards</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-semantic-model-with-ADO-Command-unable-to-find-model/m-p/4141418#M55191</link>
      <description>&lt;P&gt;I'm using the below code in C# .net with an ADO Connection to create a Semantic Model in the power bi service.&amp;nbsp; This code runs perfectly.&amp;nbsp; &amp;nbsp;However, afterwards even though I can see the model in the workspace the "getbyname" command isn't working.&amp;nbsp; I've tried disconnecting and then reconnecting, disconnect, wait and reconnect to no avail.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to refresh the connection or something that would allow me to consistently see the model I have just created?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; using (AdomdConnection connection = new AdomdConnection($"DataSource={workspaceConnection};User ID=app:{ApplicationId}@{Tenant};Password={ApplicationSecret};"))
 {
     // Open the connection
     connection.Open();

     var command = connection.CreateCommand();
     command.CommandText = xmlaScript;
     command.ExecuteNonQuery();
     

 }
 server.Disconnect();
 server = ConnectToPowerBIAsServicePrincipal(workspaceName);


 Microsoft.AnalysisServices.Database database = server.Databases.GetByName(newDatabaseName);
                   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 22:11:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-semantic-model-with-ADO-Command-unable-to-find-model/m-p/4141418#M55191</guid>
      <dc:creator>Don-Bot</dc:creator>
      <dc:date>2024-09-09T22:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create semantic model with ADO Command, unable to find model afterwards</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-semantic-model-with-ADO-Command-unable-to-find-model/m-p/4142100#M55197</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/595369"&gt;@Don-Bot&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Regarding your question, you can try the following code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;using (Microsoft.AnalysisServices.Server server = new Microsoft.AnalysisServices.Server())
{
    server.Connect(connectionString);  
    Microsoft.AnalysisServices.Database database = server.Databases.GetByName("adventureworks");
    Microsoft.AnalysisServices.Tabular.Model  model = database.Model as Microsoft.AnalysisServices.Tabular.Model;
}&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here's a screenshot of the response:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vlinyulumsft_0-1725949902114.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1164934iC1862CCE4195B384/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vlinyulumsft_0-1725949902114.png" alt="vlinyulumsft_0-1725949902114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here are the relevant links, I hope you find it helpful:&lt;/P&gt;
&lt;P style="margin: 0in;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://stackoverflow.com/questions/63700003/azure-analysis-service-tabular-model-connecting-to-power-bi-service-netcore-dat" target="_blank"&gt;&lt;SPAN&gt;.net core - Azure Analysis Service Tabular Model connecting to Power BI Service .NetCore Database.Model is null exception - Stack Overflow&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Of course, if you have any new ideas, you are welcome to contact us.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 06:31:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-semantic-model-with-ADO-Command-unable-to-find-model/m-p/4142100#M55197</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-10T06:31:53Z</dc:date>
    </item>
  </channel>
</rss>

