RegisterTaskOnAccept is ignored

Topics: Errors
Dec 28, 2015 at 6:02 PM
Using the code below, when the user tries to save the task, they do NOT get prompted for user id & password. No Author property is set for the task, and the created task is set to 'Run only when user is loggen on'. What could be causing the library to ignore the editorForm.RegisterTaskOnAccept = True ?
Dim editorForm As New TaskEditDialog()
editorForm.Title = "Create New Task"
editorForm.Editable = True
editorForm.RegisterTaskOnAccept = True
editorForm.Initialize(ts)
editorForm.ShowDialog()
Coordinator
Dec 29, 2015 at 6:50 PM
That should work. Try the following and let me know if this changes anything:
Dim regTask As Task = Nothing
Dim editorForm As New TaskEditDialog(ts, Nothing, True, True) With {.Title = "Create New Task"}
If editorForm.ShowDialog() = Windows.Forms.DialogResult.OK Then
    regTask = editorForm.Task
End If
Dec 29, 2015 at 9:14 PM
Same exact behavior using the alternative code you provided above.

I suspect the dialog is not recognizing that the radio button for 'Run whether user is logged or not' was selected.
Coordinator
Dec 30, 2015 at 6:38 AM
I see now what you were asking. I found the bug and it will be corrected in the next release (2.5.10). Until then, you can use this as a work around:
Dim regTask As Task = Nothing
Dim td As TaskDefinition = ts.NewTask()
td.Principal.LogonType = LogonType.InteractiveToken
Dim editorForm As New TaskEditDialog(ts, td, True, True) With {.Title = "Create New Task"}
If editorForm.ShowDialog() = Windows.Forms.DialogResult.OK Then
    regTask = editorForm.Task
End If
Marked as answer by dahall on 12/29/2015 at 11:38 PM
Dec 30, 2015 at 1:27 PM
The workaround works if you:
a) change TaskEditDialog(ts, td, True, True) to TaskEditDialog(ts, td, True, False)
b) take care of changing the logon type (to 'Password'), prompting the user for logon info, and registering the task.

New Problem: that process works but the library reports a blank td.RegistrationInfo.Author even though the editor shows author information.
I've seen that happen with other scenarios. Something is wrong with td.RegistrationInfo.Author for library-created tasks.
Dec 30, 2015 at 4:17 PM
Version 2.5.10 indeed fixes the lack of registration issue.
The Author info is still reported as blank.