Error accessing Active Directory form code

  • Hello,

    I designed a report that needs to retrieve and display some Active Directory information. For this purpose I wrote a function (that works perfectly in Vb.Net) and added it to the 'Code' section of the report:

    Public Function GetUserName(sUserID As String) As String

    'retrieve name of LDAP user

    'NOTE: myDirectoryEntry is the System.DirectoryServices.DirectoryEntry class instance declared in the References area

    myDirectoryEntry.Path="LDAP://OU=Users,OU=DomainName,DC=abc,DC=enterprise,DC=ca"

    'error is generated at the line above (see decription below)

    ...........commented all remaining code.........

    End Function

    When previewing the report I get the following error:

    "Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed."

    I added a reference to System.DirectoryServices and a class instance name for System.DirectoryServices.DirectoryEntry and named it myDirectoryEntry.

    I am using SQL SERVER 2008 SP1

    Any help will be greatly appreciated,

    Regards,

    Mircea R.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply