<?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 a new Power BI Report using C# in XMLA Endpoint in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3467021#M44849</link>
    <description>&lt;P&gt;I thought your request was for creating a report from scratch, rather than cloning a report.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Oct 2023 14:49:20 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-10-09T14:49:20Z</dc:date>
    <item>
      <title>Create a new Power BI Report using C# in XMLA Endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3458271#M44791</link>
      <description>&lt;P&gt;I've worked through the Learning TOM code and have successfully created a dataset in Powe BI Service with it.&amp;nbsp; I can go into it manually and create my own reports from scratch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, is there a way I can create a power bi report using C# and XMLA Endpoint?&amp;nbsp; My end goal is to publish the dataset I can now create with it's own blank report that users can just edit and adjust on their own in embeded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are links I've gone through but I haven't found anything yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/PowerBiDevCamp/Tabular-Object-Model-Tutorial/blob/main/Solution/Exercise04/PBI-Tool/Program.cs" rel="nofollow noreferrer" target="_blank"&gt;https://github.com/PowerBiDevCamp/Tabular-Object-Model-Tutorial/blob/main/Solution/Exercise04/PBI-Tool/Program.cs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlservercentral.com/blogs/power-bi-meets-programmability-tom-xmla-and-c" rel="nofollow noreferrer" target="_blank"&gt;https://www.sqlservercentral.com/blogs/power-bi-meets-programmability-tom-xmla-and-c&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.powerbidevcamp.net/articles/programming-datasets-with-TOM/" rel="nofollow noreferrer" target="_blank"&gt;https://www.powerbidevcamp.net/articles/programming-datasets-with-TOM/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 19:41:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3458271#M44791</guid>
      <dc:creator>Don-Bot</dc:creator>
      <dc:date>2023-10-03T19:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new Power BI Report using C# in XMLA Endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3460412#M44810</link>
      <description>&lt;P&gt;Look at reports in notebooks. They use some AI functions for a basic report layout based on the provided data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://powerbi.microsoft.com/en-us/blog/announcing-power-bi-in-jupyter-notebooks/" target="_blank"&gt;Announcing Power BI in Jupyter notebooks | Microsoft Power BI Blog | Microsoft Power BI&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 21:13:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3460412#M44810</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-04T21:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new Power BI Report using C# in XMLA Endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3467012#M44848</link>
      <description>&lt;P&gt;Thank you for the reply&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/100342"&gt;@lbendlin&lt;/a&gt;&amp;nbsp;I was actually able to accomplish this utilizing REST API scripts.&amp;nbsp; Although now I am working on how to create an access token programmatically.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;


namespace Learning_TOM
{
    internal class ReportClone
    {
        static readonly HttpClient client = new HttpClient();

        public static async Task callReportCloneRestAPI()

        {
            
            try
            {
                var reportName = "REPORT_NAME";
                var reportID = "REPORT_ID";
                var targetModelID = "MODEL_ID";
                var targetWorkspaceID = "WORKSPACE_ID";
                var bearer = "TOKEN";

                var url = $"https://api.powerbi.com/v1.0/myorg/reports/{reportID}/Clone";
                var data = "{\r\n  \"name\": \"" + reportName + "\",\r\n  \"targetModelId\": \"" + targetModelID + "\",\r\n  \"targetWorkspaceId\": \"" + targetWorkspaceID + "\"\r\n}";
               

                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + bearer);

                var content = new StringContent(data, Encoding.UTF8, "application/json");

                HttpResponseMessage response = await client.PostAsync(url, content);

                response.EnsureSuccessStatusCode();

                string responseBody = await response.Content.ReadAsStringAsync();

                Console.WriteLine(responseBody);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error copying reports: " + ex.Message);
                Console.ResetColor();
            }
        }

    
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Oct 2023 14:44:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3467012#M44848</guid>
      <dc:creator>Don-Bot</dc:creator>
      <dc:date>2023-10-09T14:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new Power BI Report using C# in XMLA Endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3467021#M44849</link>
      <description>&lt;P&gt;I thought your request was for creating a report from scratch, rather than cloning a report.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 14:49:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-a-new-Power-BI-Report-using-C-in-XMLA-Endpoint/m-p/3467021#M44849</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-09T14:49:20Z</dc:date>
    </item>
  </channel>
</rss>

