I would like to send a custom notification to the user that initiated a task add-in that I have written. Is there any way to determine the user that initiated a task, in particular by ID so I can send a message to the user?
I would like to send a custom notification to the user that initiated a task add-in that I have written. Is there any way to determine the user that initiated a task, in particular by ID so I can send a message to the user?
I was hoping to stay out of the database. I've not had to dig there yet, so I have no idea where the connection string would come from.
The task definition has a 'user to run as' field - I was going to see what lies there the next time I have the code in shape to run.
I haven't had much time to play with the task interfaces yet. I thought you might be able to use SetValEx and GetValEx by putting the currently logged in user there, but it would probably use the user the task is excuting as and you already have that.
When I need a connection strng I put it in another class, encrypted. (And I use a read only user.)
You're welcome for the data helper class. I'm glad you found it useful.
For anyone following this, you can use the vault.GetLoggedInWindowsUserID call in OnTaskLaunch to get the user name, and use SetValEx to store it away for later user. It returns the ID of the user (int).
Now, I have the problem off notifications not working in tasks - I use the ID to get a IEdmUser5, and make a SendMsg call from there, but get nothing, and no errors are raised.
I don't see anything in the API that will give you what you're looking for directly. One would think it would be a property of the task instance.
You could try using the InstanceGUID and query the TaskInstances table for the InitUserID when your task is complete.