locked
How to get duplicate accounts from sharepoint profile RRS feed

All replies

  • What is the scope you are asking. If it is site collection level we can use LINQ. Or else we can do an SQL Query for this.
    Thanks, Saravanan PRS
    Tuesday, January 10, 2012 6:04 AM
  • thanks for the reply.

     

    can you please share the code using both SQL or LINQ.

     

    Thanks,

    Devendra


    MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
    Tuesday, January 10, 2012 8:05 AM
  • Right now i don't have sharepoint in my system. so cann't give you the SQL query.

     

    List<string> existingUsers; // just for temporary purpose

    private bool checkAlreadyExist(SPUser user)

    {

    if(existingUsers.Contains(user.DisplayName))

    {

    return true;

    }

    else

    {

    existingUsers.Add(user.DisplayName);

    return false;

    }

    }

     

    using(SPSite site=;;;;;)

    {

    using(SPWeb web = site.RootWeb)

    {

    SPUserCollection users = web.AllUsers;

     

    IEnumerable<SPUser> iDuplicateUsers = from user in users where (CheckAlreadyExist(user) select user;

     

    }

    }

    the iDuplicateUsers will have all the duplicate user objects. You can do anything with it. There might be some compile time error. Bcoz there is no VS2010 right now in my machine .


    Thanks, Saravanan PRS
    Tuesday, January 10, 2012 9:00 AM
  • when ever i search in Poeple search i am getting two users with the same name.

    i want to know how many of those type(duplicate) users exists in sharepoint farm.

     

    Thanks,

    Devendra

     


    MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
    Tuesday, January 10, 2012 9:52 AM