Forum Discussion
sammicrosoft
8 years agoNew Member
Unable to Clone or Copy the Power BI Report
Dear All, I had written the below code to clone the Power BI report , But I don't find the luck to clone the report . Can any one help me in knowing what's wrong in my below code. Code: ...
- 8 years ago
As per the online documentation Clone report, it requires 3 parameters in the data JSON when calling that API. Based on my test, the below demo works to copy a report.
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(); }
Eric_Zhang
Microsoft Employee
8 years agoAs per the online documentation Clone report, it requires 3 parameters in the data JSON when calling that API. Based on my test, the below demo works to copy a report.
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();
}