locked
Convert Non AD user into AD users RRS feed

  • Question

  • Hi

      We have an environment where non active directory users can log in to sharepoint. We have some service accounts available in Active directory.

      We need to store the non active directory users and respective AD service account details. If non AD user log in to sharepoint then user should convert into respective AD service account.

    Thanks

    Hari

      

    Monday, February 20, 2017 1:21 PM

Answers

  • Hi,

    I think you could add the user to AD dynamically.

    public void AddToGroup(string userDn, string groupDn)
    {
        try
        {
            DirectoryEntry dirEntry = new DirectoryEntry("LDAP://" + groupDn);
            dirEntry.Properties["member"].Add(userDn);
            dirEntry.CommitChanges();
            dirEntry.Close();
        }
        catch (System.DirectoryServices.DirectoryServicesCOMException E)
        {
            //doSomething with E.Message.ToString();
    
        }
    }

    You could check below link for more details.

    https://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C#36

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, February 21, 2017 1:38 AM