¿Cómo puedo obtener la lista de todos los usuarios que informan al usuario en particular usando UserProFileManager?

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/46011

Pregunta

Puedo ver que la clase de Filmanagerager de UserProfileManager tiene un método GetManager () para tirar del administrador del perfil de los usuarios, pero no veo nada que devuelva la lista de todos los usuarios que actualmente reportan al usuario en particular.Me pregunto si hay alguna solución.

SPSite site;
SPWeb web;
SPServiceContext serviceContext;
UserProfileManager profiles;
UserProfile profile;

try
{
  using (site = new SPSite(SPContext.Current.Web.Url))
  {
    using (web = site.OpenWeb())
    {
      serviceContext = SPServiceContext.GetContext(site);
      profiles = new UserProfileManager(serviceContext);

      //Getting the profile of logged in user.
     profile = profiles.GetUserProfile(web.CurrentUser.LoginName);

    //Getting profile of the manager of the logged in user.
    profile = profile.GetManager();
    }
  }
}
catch { }

¿Fue útil?

Solución

De hecho, tiene métodos para obtener gerente, compañeros y informes directos:

        // Check whether the user profile and the manager user profile exist, and that they are not                  
        // the same user.            
        if (userProfileManager.UserExists(loginName))
        {
            // Retrieve the user profile.                
            UserProfile userProfile = userProfileManager.GetUserProfile(loginName);  

            // Get the user's multiple levels of managers, peers, and direct reports.                 
            managers = new List<UserProfile>(userProfile.GetManagers());                
            peers = new List<UserProfile>(userProfile.GetPeers());                
            directReports = new List<UserProfile>(userProfile.GetDirectReports());

}

funciona en 2007, debería ser el mismo en 2010: http://msdn.microsoft.com/en-us/library/CC973103 (v= Office.12) .aspx

Licenciado bajo: CC-BY-SA con atribución
scroll top