public void getuserprofilesyncCustomattrib utesvalues(string MysitecollectionUrl)
{
SPSecurity. RunWithElevatedPrivileges( delegate
{
using (SPSite siteCollection = new SPSite(MysitecollectionUrl))
{
using (SPWeb site = siteCollection.OpenWeb())
{
ServerContext context = ServerContext.GetContext( siteCollection);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (UserProfile profile in profileManager)
{
string PersonalSiteUrl = ((string)profile[" PersonalSpace"].Value);
string AccountName = ((string)profile["AccountName" ].Value);
}
}
}
});
}
public void getuserprofilesyncDefaultattri butesvalues(string MysitecollectionUrl)
{
SPSecurity. RunWithElevatedPrivileges( delegate
{
using (SPSite site = new SPSite(MysitecollectionUrl))
{
ServerContext context = ServerContext.GetContext(site) ;
UserProfileManager profileManager = new UserProfileManager(context);
foreach (UserProfile profile in profileManager)
{
string Department = Convert.ToString(profile[ PropertyConstants.Department]. Value);
string AccountName = Convert.ToString((profile[ PropertyConstants.AccountName] .Value));
string Name = Convert.ToString((profile[ PropertyConstants. PreferredName].Value));
}
}
});
}
No comments:
Post a Comment