Forum Discussion

luojiandanbi's avatar
luojiandanbi
New Member
1 year ago
Solved

Can store data in LocalStorage on the desktop?

definition localstorage in capabilities.json file: "privileges": [ { "name": "LocalStorage", "essential": true } ] in update(),the code is: const storage =options.host.s...
  • Poojara_D12's avatar
    1 year ago

    Hi luojiandanbi 

    You're developing a Power BI custom visual that uses the storageService API to store data (like a visitor ID) in local storage, and it works correctly when the visual runs in Power BI Service (the web version). However, in Power BI Desktop, the storage.status() call returns "DisabledByAdmin", which means local storage access is blocked. This happens even though you've correctly declared the LocalStorage privilege as "essential": true in your capabilities.json file. The reason for this is that Power BI Desktop does not support local storage for custom visuals by design, due to security and administrative restrictions—especially in corporate environments where local persistence might be a risk. This behavior cannot be overridden by code or capabilities configuration. As a workaround, if you need to store parameters or state, consider using dataView objects or visual objects (properties saved with the report) for persistent storage across sessions, or use in-memory variables for temporary session-based logic. If you need user-specific storage that persists beyond a report session, you'll likely need to implement an external service or API that your visual can call. In summary, local storage is not supported in Power BI Desktop, and you'll need to adopt an alternative method for storing data based on your use case.