none
SharePoint API add user in sharepoint which is disabled on Active Directory but in case of UI it's not allow RRS feed

  • Question

  • Hi

    I have used SharePoint API in my application for user management in ShrePoint site collection, but i have faced some issued related to disabled user in AD . I am trying to add user in sharepoint through this method.

               spWeb.AllowUnsafeUpdates = true;
              spWeb.SiteGroups[grp].AddUser(domain\user,"","","");  

    User added successfully , but in case if user is disabled on AD also add with this method , in normal UI case it not add this disabled user , so what i do for that  usecase.

    Is ensureUser method only specific to AD as back of Sharepoint or it is valid for LDAP or other back store.


    • Edited by BhosaleR Tuesday, September 18, 2012 5:42 AM
    Tuesday, September 18, 2012 5:31 AM

Answers

  • Hi BhosaleR,

    Based on my understanding, SPWeb.EnsureUser method only works for active user in AD, if not, you may see “Specified user cannot be found” error when calling this method. In this situation, you may get users in AD which are active to SharePoint using programming, if so, you may refer to the following article for more information:
    http://www.christopherballllc.com/blog/?p=172

    Thanks,


    Qiao Wei

    TechNet Community Support

    Wednesday, September 19, 2012 8:50 AM
    Moderator