List of database users: can you run C# Code in SQL Server Management Studio?
The only language1 supported in SQL Server is T-SQL.  Having said that, it's pretty simple to use T-SQL to get the details you need.

/*
    Description: Display the Active Directory group 
    membership permission path for all users
*/
SET NOCOUNT ON;
DECLARE @t TABLE (
    [account name] varchar(255)
    , [type] varchar(255)
    , [privilege] varchar(255)
    , [mapped login name] varchar(255)
    , [permission path] varchar(255)
);

INSERT INTO @t
EXEC xp_logininfo;
DELETE 
FROM @t
WHERE type = 'group';
DECLARE @cmd nvarchar(max);
DECLARE cur CURSOR LOCAL FORWARD_ONLY READ_ONLY STATIC FOR
SELECT 'EXEC xp_logininfo @acctname = ''' + name + ''', @option = ''members'';'
FROM master.sys.server_principals
WHERE type = 'G';
OPEN cur;
FETCH NEXT FROM cur INTO @cmd;
WHILE @@FETCH_STATUS = 0
BEGIN
    INSERT INTO @t
    EXEC sp_executesql @cmd;
    FETCH NEXT FROM cur INTO @cmd;
END
SELECT *
FROM @t t
ORDER BY t.[account name];
CLOSE cur;
DEALLOCATE cur;


The results returned show users with access to the SQL Server, and shows the group they are a member of that is providing that access.

You'll need membership in the sysadmin fixed server role or membership in the public fixed database role in the master database with EXECUTE permission granted to execute xp_logininfo.  You'll need standard user rights in Active Directory to enumerate the items in the directory.



1 - R is supported in certain configurations, and Python is supported in SQL Server 2017 and above.  Generally speaking, you'll want to use T-SQL.  Depending on your acceptable security posture, you may be able to use C# or Visual Basic to create a SQLCLR stored procedure that can be called from T-SQL in SQL Server 2005 and above.