When I am trying to retrieve the sharepoint site sign in user details from SharePoint Peoples and user group, I have faced some confusions as discussed below.
For example consider that we need the email address of the current user.According to my requirement i used property shown below
SPContext.Current.Web.CurrentUser.EMail returns only the current Sign in User email address
and CurrentWeb.AllUsers[Properties.UserLoginName].Email also returns email address.
AllUsers returns all users who are either members of the site or who have browsed to the site as authenticatedmembers of the domain group in the site.
CurrentUser returns only the current sign in user details.
Conclusion:
For example consider that we need the email address of the current user.According to my requirement i used property shown below
SPContext.Current.Web.CurrentUser.EMail returns only the current Sign in User email address
and CurrentWeb.AllUsers[Properties.UserLoginName].Email also returns email address.
AllUsers returns all users who are either members of the site or who have browsed to the site as authenticatedmembers of the domain group in the site.
CurrentUser returns only the current sign in user details.
Conclusion:
- If we want to current user details, we can use both properties as shown above.
- If we want the user details of particular user other than current user we need to use the AllUsers property.
No comments:
Post a Comment