Getting all Groups within a Group

GuyS (45 posts)
January 2, 2018 08:12 AM
Accepted Answer

Hi Bill,

First all the best wishes for 2018!

I'm getting my way in the adTempus API's (, trying at least). Nice, I like it.

I wrote some C# code to get all the jobs in a group (see Attachment), but I also need to get all groeps.

I can't find it yet, can you help? What do I need to do?

Thanks,

Guy

 

Bill Staff (601 posts)
January 2, 2018 08:37 AM
Accepted Answer

You just need the GetGroups method:

group.GetGroups(ObjectFetchOptions.FullFetch,true)
GuyS (45 posts)
January 2, 2018 08:55 AM
Accepted Answer
Then I probably need an additional USING?
Bill Staff (601 posts)
January 2, 2018 01:23 PM
Accepted Answer

I don't understand your question, or what your screen capture is illustrating. It would be easier if you paste your code into your message (use the button that looks like a paintbrush at the right end of the toolbar). But I think I confused you.

Your original code was correct: call context.GetJobGroup to get a particular group.

Then you just need to call group.GetGroups, just like you are currently calling group.GetJobs.

GuyS (45 posts)
January 2, 2018 02:41 PM
Accepted Answer

Hi Bill,

Found it! Thanks.

public void GetAdtGroups(ref ListView lvMsg, string groep)
{
    using (DataContext context = aScheduler.NewDataContext())
    {
        try
        {
            var group = context.GetJobGroup(groep);
            JobGroupCollection jgc = group.GetGroups(ObjectFetchOptions.FullFetch, true);
            DisplayAdtJobs daj = new DisplayAdtJobs();
            daj.DisplayAdt(jgc);
        }
        catch (Exception e)
        {
            MessageBox.Show("??" + e.ToString());
            throw;
        }
    }
}
Bill Staff (601 posts)
January 2, 2018 04:24 PM
Accepted Answer
Yep, that looks right.
Post by user ucabrera moved to topic Finding a job within a Group

Replies are disabled for this topic.