Hi Everyone,
As part of a security review, I've been asked to look into automating disabling user's windows accounts when a Separation Form is submitted for LF Forms.
I've been able to modify a C# script (that works outside of Laserfiche) enough to not get any errors, but it doesn't really work either. It gives a warning that there "No entry points were found in Script 1.cs."
Would anyone have ideas on what I'm missing here? We are using Workflow and Laserfiche 10.4. I do have a VB script that works outside of Laserfiche if VB is simply a better route than C#.
Thanks
namespace WorkflowActivity.Scripting.SDKScriptC { using System; using System.Collections.Generic; using System.Drawing; using System.DirectoryServices.AccountManagement; using System.Windows.Forms; using Laserfiche.RepositoryAccess; using Laserfiche.Workflow.Activities; public partial class MainForm : Form { // Private Method private static void DisableADUserUsingUserPrincipal(string username) { try { PrincipalContext principalContext = new PrincipalContext(ContextType.Domain); UserPrincipal userPrincipal = UserPrincipal.FindByIdentity (principalContext, username); userPrincipal.Enabled = false; userPrincipal.Save(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } // Private Method with return type "Boolean" to determine if the method succeed or not. private static bool EnableADUserUsingUserPrincipal(string username) { try { PrincipalContext principalContext = new PrincipalContext(ContextType.Domain); UserPrincipal userPrincipal = UserPrincipal.FindByIdentity (principalContext, username); userPrincipal.Enabled = true; userPrincipal.Save(); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); } return false; } void Button1Click(object sender, EventArgs e) { string strUserName = "AD_Username"; // This is a LF Workflow custom token. Its value is the employee's active directory username DisableADUserUsingUserPrincipal(strUserName); } void Button2Click(object sender, EventArgs e) { string strUserName = "AD_Username"; // This is a LF Workflow custom token. Its value is the employee's active directory username EnableADUserUsingUserPrincipal(strUserName); } } }