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

Discussion

Discussion

How can I add Windows user to a new laserfiche group using SDK script

posted on August 25, 2016

I am trying to add an existing Windows account set in laserfiche to a new creation group.

 

I make my group creation by using script but fail to add Windows account.

I can add laserfiche account but I want to add Windows account.

 

 // create group
            try
            {
                GroupInfo GI = new GroupInfo();               
                GI.Name = "1234-4321";
                GI.Session = RASession;
                GI.FeatureRights = FeatureRights.Scan | FeatureRights.Search | FeatureRights.Print | FeatureRights.Export;
                GI.Save();
                
        // assign member to group                   
               AccountInfo AI = Account.GetInfo(GI.Name, RASession);
               AccountReference AR = new AccountReference(AI);
               List<string> list = new List<string>();
               list.Add("domain\\newuser");
               list.Add("admin");
               IEnumerable<string> newlist = list;          
               Account.AddMembersToGroup(AR, newlist, RASession);
                
            }
             catch (Exception ex)
            {
            MsgBox("error in creation group, group already exist" + ex);
            }

 

0 0
replied on September 1, 2016

Use Account.LinkWindowsAccount:

IdentityReferenceCollection memberList = new IdentityReferenceCollection();
AccountReference acctRef = new AccountReference(@"domain\accountName", session);
memberList.Add(acctRef.ToSecurityIdentifier());

Account.LinkWindowsAccounts("LF Group", memberList, session);

 

1 0
replied on September 6, 2016

I tried this and it has worked

1234-4321 is the group I want to add Windows domain users

and acctName is the variable that containt the domain\username

 

AccountInfo AI = Account.GetInfo("1234-4321", RASession);
AI.LinkWindowsAccount(new System.Security.Principal.NTAccount(acctName));
AI.Save();

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.