I want to retrieve information through GQI that is specific to the logged-in user. Is it possible to pass the user to an ad-hoc data source (IGQIDataSource)? Or, can I use a placeholder in GQI that defines the user that is logged in?
Hi Michiel,
This is indeed a common use-case that we'll want to support soon.
Unfortunately there is no good way yet to retrieve info about the current user or connection to be able to use it to retrieve external data.
We have this feature on our backlog as part of larger projects.
At present there does exist an ugly workaround.
IMPORTANT: only use this approach for prototyping or when the query is not executed often since it creates a new connection every time the query is executed!
- Implement the IGQIOnInit interface for your ad-hoc data source.
See: IGQIOnInit docs - Use the GQIDMS object provided in the OnInitInputArgs to request an authentication ticket for the current user.
See also: GQIDMS docs - Connect to the WebAPI using the ConnectAppAndInfoUsingTicket method, providing the ticket retrieved in step 2.
See: WebAPI docs - In the response you can find among other things the full name, login name and email address of the current user.