O'Reilly logo

Microsoft Dynamics NAV 2009 Programming Cookbook by Matt Traxinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Checking Active Directory groups

A common practice is to assign security through Active Directory groups. NAV supports this out-of-the-box, but does not give a way to manually check those groups from code. For that you will need to implement a .NET class.

Getting ready

The codeunit from the Checking for user-assigned roles recipe should be created.

How to do it...

  1. Create the following class in Visual Studio. You will need to add a reference to System.DirectoryServices.
    using System; using System.Collections; using System.DirectoryServices; using System.DirectoryServices.ActiveDirectory; using System.Runtime.InteropServices; using System.Security.Principal; namespace NAV_ActiveDirectory { [ProgId("NAV_ActiveDirectory")] [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDual)] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required