C# Sample

I am trying the C# sample EnumerateMembership.  When I run the sample, the following error is generated

Generic Exception Handler: System.Runtime.InteropServices.COMException (0x800414
52): Unknown error (0x80041452)
   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_Name()
   at ActiveRoleTest.EnumerateMembership.Main(String[] args) in c:\temp\activero
letest\enumeratemembership.cs:line 22

Any suggestion?


using System;
using System.DirectoryServices;
using ActiveDs;
using EDMLib;

namespace EnumerateMemberships

class Class1
static void Main(string[] args)
string strUserADsPath = "EDMS://cn=UserName,ou=....";
DirectoryEntry oUser = new DirectoryEntry(strUserADsPath);
Console.WriteLine("Groups to which belongs:"+ oUser.Name);
// Invoke IADsUser::Groups method.
IADsMembers groups = oUser.Invoke("Groups") as IADsMembers;
foreach ( object group in groups)  
// Get the Directory Entry.
DirectoryEntry groupEntry  = new DirectoryEntry(group);