I have created a custom group in WSS. I have assigned users to the
group.
I am programming a web part and need to know the groups (or the
specific group) the user belongs to.
My entire search has yielded to Page.User.Identity.Name.ToString(),
which obviously goes not give the group names.
Has any one been able to get the group names? I presume this is a
basic need and there will be a way to get at this. If so, please give a hint
or a code snippet.
Thanks,
Zee
Zee
SPUser user = web.CurrentUser; //of another user
SPRoleCollection roleColl = user.Roles;
SPGroupCollection groupColl = user.Groups;
foreach (SPRole role in roleColl)
{
role.Name; //do something with role
}
foreach (SPGroup group in groupColl)
{
group.Name; //do something with group
}
Saludes
I am using WSS & writing this as a web part. When I use
SPWeb web = SPControl.GetContextWeb(Context);
SPUser user = web.CurrentUser;
and check on debug mode on VS.NET, the object web cant get a value
for CurrentUser instead its shown as
"CurrentUser <error: an exception of type:
{System.Security.SecurityException} occurred> Microsoft.SharePoint.SPUser"
Any ideas on solving this security exeption? Arent the
Microsoft.Sharepoint.***
trusted???
Thanks
You probably don't wanna hear this right now, but do you want to go in production
using full trust mode? You would be better of analyzing what security permission
you're security policy file is missing and add this to the policy file. And
what do you mean exactly when you say Microsoft.SharePoint.* assemblies are
trusted? Some SharePoint assemblies are registered by default as safe controls
so certain web parts can be used. This doesn't mean that custom code can
use every aspect of the SharePoint object model, this behavior is determined
by the security policy file configured in de <trust> level element of the
web.config file.
Kind regards,
Nikander & Margriet Bruggeman
how can display all user details information information in wss3.0 i m
waiting Ur +ve response