How is it possible to get the portal ID on which a SchedulerClient inherited object's DoWork() method is running with the DNN API or another way?
The scheduler does not run in the context of any particular portal, so there isn't a portal ID to retrieve. You can call an API like PortalController.GetPortalList to get all of the portals and iterate over them.
PortalController.GetPortalList
Posted By Brian Dukes on 01 Aug 2019 02:57 PM The scheduler does not run in the context of any particular portal, so there isn't a portal ID to retrieve. You can call an API like PortalController.GetPortalList to get all of the portals and iterate over them.
This is how we do this, most often.
In the cases where there are a lot of portals or when we just need to avoid that kind of logic, we'll usually build in a way to provide configuration details, such as a static XML or JSON file. If you go the route of having a static config file, I'd suggest naming it with a .resources extension to make sure it never gets served to anonymous requests.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.