You are viewing limited content. For full access, please sign in.

Question

Question

Get AD user groups with SDK

asked on June 4, 2017

Hi experts.

Is there any SDK method or property to get the groups to which an AD user is assigned in repository?

It is possible to obtain the data of the native users of Laserfiche, I am using RA.

Thanks in advance.

-------------

Que tal expertos.

Existe algún método o propiedad de SDK para obtener los grupos a los que está asignado un usuario en el repositorio.

Sé que es posible obtener este dato de un usuario nativo de Laserfiche. Estoy utilizando RA.

 

Gracias.

0 0

Answer

SELECTED ANSWER
replied on June 5, 2017

To get the LF groups that a windows account belongs to, use Trustee.GetLinkedAccounts:

AccountReference acctRef = new AccountReference(sid, session); // sid is the SecurityIdentifier for the windows account

AccountReferenceCollection groupCollection = Trustee.GetLinkedAccounts(acctRef, session);

List<string> lfGroups = groupCollection.Select(group => group.AccountName).ToList();

 

1 0

Replies

replied on February 28, 2018

Hi Laserfiche progammers...

I'm trying to use the above code to list all groups a user belong to but the last line gives me an error. It says the "Select" is not accepted with this method. It also says "Is there a missing Assembly Reference?".

Not sure what is missing here.  Any idea?

0 0
replied on February 28, 2018

I found it...

 

I had to add the following to my code as the "Select" is part of the "System.Linq":

using System.Linq;

 

Hope this will help others :)

0 0
replied on April 17, 2019

Hi Daniel,

Thanks for the clarification. I'm also trying to run this but can't compile as it says "sid" and "session" do not exist. Do you know what else needs to be in the script to make it work?

Thanks,

Julie

You are not allowed to follow up in this post.

Sign in to reply to this post.