We are working on a script task to add and remove members from a group. The task only works if the values are hard coded within the task.
Here is the code that works:
//Create a variable for the group string GroupName = "Test"; //Identify a Win Account to Remove string WinName = "ABC\\NewUser"; // Lookup the account by name to get the SID AccountReference ActRef = new AccountReference(WinName, RASession); // Retrieve the SID SecurityIdentifier sid = actRef.ToSecurityIdentifier(); //Get the Group GroupInfo gi = (GroupInfo)Account.GetInfo(GroupName, RASession); //Remove the specific Windows Account gi.UnlinkWindowsAccount(sid); // Save the GroupInfo object gi.Save();
This all works. The problem arises when we try to use any token in place of the hard coded value.
For instance, none of these work, giving us a Trustee Not Found message:
//Using properties from the FindGroup Task string GroupName = "FindGroup_Display Name"; //Using properties from the FindGroup Task string GroupName = "FindGroup_Account Name"; //Using properties from the FindGroup Task string GroupName = "FindGroup_Qualified Name"; //Using a hard coded token name, defined in Assign Token Values //and hard coded to "Test" string GroupName = "GroupName";
All of these tokens show up in the Track Tokens list with the correct name, "Test". Is there something obvious we are missing?