4.5.2 Synchronize Two Users

Assume that a site collection administrator requests to write a small application to copy memberships associated with one user to another user. The application will also remove any memberships that the second user does not have. For the data described previously , the application will copy P2's memberships to P1 using the following steps:

  1. Obtain memberships for both users.

  2. Add any memberships that exist in P2 to P1.

  3. Remove any memberships that exist in P1 that do not exist in P2.