title: How to edit Power BI Desktop document parameters or data sources programmatically with C#?
body: <p>I have a report template which is built in Power BI Desktop and is saved as .pbix or .pbit file. This template uses DirectQuery SQL database as data source, whereas server address and database name are extracted to parameters. There is also a parameter which holds a <code>ReportId</code>, which is used in queries. </p>
  
  <p><a href="https://i.stack.imgur.com/eMWcp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eMWcp.png" alt="Power BI window screenshot"></a></p>
  
  <p>I also have a C# application, which is supposed to generate Power BI Desktop reports from this template.<br>
  How can create a report with specific parameters programmatically?<br>
  Something like Power BI Desktop does itself when you open .pbit template file, enter parameters and it generates .pbix document. </p>
  
  <p>I didn't find any SDK \ Interop libraries for Power BI Desktop.<br>
  I have tried to open a document as ZIP, but <code>DataModel</code> file is archived, and therefore not a well-formed XML.<br>
  I have also tried to extract this parameters to JSON file and load it as a data source, but relative paths are not supported by Power BI. </p>