Forum Discussion
Custom Visual to distinguish between Power BI Desktop and Power BI service
- 5 years ago
Hi Husain,
I don't commercialise my visuals but I presume that you'll want to look at the hostEnv property on the options (IVisualHost) object exposed in the constructor method. This value is from the CustomVisualHostEnv enum and you should be able to use it to distinguish the current host environment.
As this is only available at instantiation, you would probably use the constructor to set up the watermark element based on your criteria, but if your logic handles this outside the constructor then I would store this value in a separate class property for later on if needed.
Also: it looks like this was introduced in 3.2.0 of powerbi-visuals-api, so ensure you have at lease that version for it to be usable in your project.
Regards,
Daniel
Hi Husain,
I don't commercialise my visuals but I presume that you'll want to look at the hostEnv property on the options (IVisualHost) object exposed in the constructor method. This value is from the CustomVisualHostEnv enum and you should be able to use it to distinguish the current host environment.
As this is only available at instantiation, you would probably use the constructor to set up the watermark element based on your criteria, but if your logic handles this outside the constructor then I would store this value in a separate class property for later on if needed.
Also: it looks like this was introduced in 3.2.0 of powerbi-visuals-api, so ensure you have at lease that version for it to be usable in your project.
Regards,
Daniel