• BTW, there's an undocumented system extended stored procedures that happens to do exactly what you're after:

    EXEC xp_sqlagent_enum_jobs 1, SUSER_SNAME

    -- Gianluca Sartori