<?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 Unable to Clone or Copy the Power BI Report in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Unable-to-Clone-or-Copy-the-Power-BI-Report/m-p/293510#M8616</link>
    <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had written the below code to clone the Power BI report , But I don't find the luck to clone the report .&lt;/P&gt;&lt;P&gt;Can any one help me in knowing what's wrong in my below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function CopyReport(reportId, Name, Dataset) {
    debugger;
    var deferred = $.ajax({
        url: "https://api.powerbi.com/v1.0/myorg/reports/" + reportId + "/Clone",
        type: "POST",
        headers: {
            "Authorization": "Bearer " + accessToken
        },
       // ContentType: "application/json",
        data: { Name: Name},
        //data: { name: Name, targetWorkspaceId: Dataset },
        success: function (responseData) {
            cache.write(responseData, "Copy report")
        },
        error: function (responseData) {
            debugger;
            cache.write(responseData, "Copy report")
        }
    });
    return deferred.promise();
}&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;{"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 12:21:23 GMT</pubDate>
    <dc:creator>sammicrosoft</dc:creator>
    <dc:date>2017-10-31T12:21:23Z</dc:date>
    <item>
      <title>Unable to Clone or Copy the Power BI Report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unable-to-Clone-or-Copy-the-Power-BI-Report/m-p/293510#M8616</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had written the below code to clone the Power BI report , But I don't find the luck to clone the report .&lt;/P&gt;&lt;P&gt;Can any one help me in knowing what's wrong in my below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function CopyReport(reportId, Name, Dataset) {
    debugger;
    var deferred = $.ajax({
        url: "https://api.powerbi.com/v1.0/myorg/reports/" + reportId + "/Clone",
        type: "POST",
        headers: {
            "Authorization": "Bearer " + accessToken
        },
       // ContentType: "application/json",
        data: { Name: Name},
        //data: { name: Name, targetWorkspaceId: Dataset },
        success: function (responseData) {
            cache.write(responseData, "Copy report")
        },
        error: function (responseData) {
            debugger;
            cache.write(responseData, "Copy report")
        }
    });
    return deferred.promise();
}&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;{"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 12:21:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unable-to-Clone-or-Copy-the-Power-BI-Report/m-p/293510#M8616</guid>
      <dc:creator>sammicrosoft</dc:creator>
      <dc:date>2017-10-31T12:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Clone or Copy the Power BI Report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Unable-to-Clone-or-Copy-the-Power-BI-Report/m-p/294004#M8654</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="45734" data-lia-user-login="sammicrosoft" class="lia-mention lia-mention-user"&gt;sammicrosoft&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;As per the online documentation &lt;A href="https://msdn.microsoft.com/en-us/library/mt784674.aspx" target="_self"&gt;Clone report&lt;/A&gt;, it requires 3 parameters in the data JSON when calling that API. Based on my test, the below demo works to copy a report.&lt;/P&gt;
&lt;PRE&gt;function CopyReport(reportId, Name, targetworkspace, targetDataset) {
    debugger;
    var deferred = $.ajax({
        url: "https://api.powerbi.com/v1.0/myorg/reports/" + reportId + "/Clone",
        type: "POST",
        headers: {
            "Authorization": "Bearer " + accesstoken
        },
       // ContentType: "application/json",
        //data: { Name: Name},
        data: { name: Name, targetWorkspaceId: targetworkspace, targetModelId:targetDataset},
        success: function (responseData) {
            cache.write(responseData, "Copy report")
        },
        error: function (responseData) {
            debugger;
            cache.write(responseData, "failed copying report")
        }
    });
    return deferred.promise();
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 06:01:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Unable-to-Clone-or-Copy-the-Power-BI-Report/m-p/294004#M8654</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-11-01T06:01:03Z</dc:date>
    </item>
  </channel>
</rss>

