SharePoint Webpart:Getting user information from distribution list

Last post 05-08-2008 4:58 AM by Radon. 8 replies.

Sort Posts:

  • SharePoint Webpart:Getting user information from distribution list

    08-03-2007, 7:19 AM
    • Loading...
    • amittuteja
    • Joined on 04-24-2007, 9:00 AM
    • Posts 9

    Hi,

    I am developing a custom webpart for sharepoint.I have to show all the links of sites and subsites of which currently logged in user has edit rights.I have been able to do this for users whose name exists in sharepoint people and groups section,but don't know how to do for users who is a part of some DL and we have given access to DL in people and groups section.

    My sample code is written below: 

      string UserLogin = System.Web.HttpContext.Current.User.Identity.Name.ToString();
                    SPUserCollection allUsers = community.Users;
                    foreach (SPUser user in allUsers)
                    {
                        if (user.LoginName.ToUpper() == UserLogin.ToUpper())
                        {
                            SPRoleCollection allGroups = user.Roles;

                       
                            foreach (SPRole group in allGroups)
                            {  bool isUserAllowed;


                                isUserAllowed = community.Permissions.DoesUserHavePermissions(SPRights.ViewListItems);
                                if(isUserAllowed.Equals(true))
                                {
                                string strStatus = "User " + UserLogin + " has Reader permissions in /" + community.Title + ".";
                                 }
                             
                            }
                    }

  • Re: SharePoint Webpart:Getting user information from distribution list

    08-06-2007, 1:50 AM

    Hi,

    Based on my understanding , do you just want to invite an Existing Distribution List to Your SharePoint Team? Because SharePoint Team Services from Microsoft uses Windows NT authentication to validate any browsers in the Web site, and because e-mail distribution lists are typically not security groups in Microsoft Windows NT, using a distribution list as a group in a SharePoint team Web site requires a minor workaround. See the following link which explains how to perform the workaround.

    http://support.microsoft.com/kb/293830/en-us

    Thanks.

    Sincerely,
    Michael Jin.
    Microsoft Online Community Support

  • Re: SharePoint Webpart:Getting user information from distribution list

    08-06-2007, 2:51 AM
    • Loading...
    • amittuteja
    • Joined on 04-24-2007, 9:00 AM
    • Posts 9

    Hi,

    Thanks for reply.But my problem is not of just adding DL to Sharepoint.What i am trying to achieve is show specific things to user depending upon the rights logged in user have,and that user could be a part of some DL as well.SO ijust needs to check if the logged in user have say Edit Rights on some site,then only show that site else do not show it.

    Thanks

    Amit 

    Filed under:
  • Re: SharePoint Webpart:Getting user information from distribution list

    08-06-2007, 3:46 AM

    Hi,

    Well, you mentioned some of the members who have rights to edit the site is from DL. Then inviting the distribution list into Sharepoint team, setting the corresponding rights, regarding them as the Sharepoint team member, so the authentication mechanism which you use is also suitable for those members from DL.

    Thanks.

    Sincerely,
    Michael Jin.
    Microsoft Online Community Support

  • Re: SharePoint Webpart:Getting user information from distribution list

    08-06-2007, 5:32 AM
    • Loading...
    • amittuteja
    • Joined on 04-24-2007, 9:00 AM
    • Posts 9

     Hi,

    Yes i hv found a way of knowing weather the user is a normal NT user or DL by using  IsDomainGroup function of SPUser class,but now a new problem has arisen.

    The code works only if the user has edit permissions,otherwise in viewer access it does not execute(Unauthorised user) .I ahve read somewhere that sharepoint imposes some security conditions on access of his OOB classes by certain usersConfused,and to overcome the above problem SPSEcurity.CodeToRunElevated has to be used.But when i try to execute my function with elevated permissions it gives admin permissions to the logged in user,that means every user has the edit access.On the contrary i want to get only the users having actual edit permissions.

    Don't know how to do it?

     

    Amit 

  • Re: SharePoint Webpart:Getting user information from distribution list

    08-06-2007, 5:33 AM
    • Loading...
    • amittuteja
    • Joined on 04-24-2007, 9:00 AM
    • Posts 9

     Hi,

    Yes i hv found a way of knowing weather the user is a normal NT user or DL by using  IsDomainGroup function of SPUser class,but now a new problem has arisen.

    The code works only if the user has edit permissions,otherwise in viewer access it does not execute(Unauthorised user) .I ahve read somewhere that sharepoint imposes some security conditions on access of his OOB classes by certain usersConfused,and to overcome the above problem SPSEcurity.CodeToRunElevated has to be used.But when i try to execute my function with elevated permissions it gives admin permissions to the logged in user,that means every user has the edit access.On the contrary i want to get only the users having actual edit permissions.

    Don't know how to do it?

     

    Amit 

  • Re: SharePoint Webpart:Getting user information from distribution list

    03-27-2008, 4:29 PM
    • Loading...
    • khaos
    • Joined on 09-12-2003, 1:59 AM
    • USA Suffolk, Virginia
    • Posts 507

    Was this ever resolved?  I am looking for this as well.

     

    Thanks,

    Joe Johnston
    If a picture is worth a 1000 words, a sample application is worth a 1000 blog entries
    The Latin root SharePoint means "as difficult as possible"
  • Re: SharePoint Webpart:Getting user information from distribution list

    04-22-2008, 2:27 PM
    • Loading...
    • khaos
    • Joined on 09-12-2003, 1:59 AM
    • USA Suffolk, Virginia
    • Posts 507

    bump

    Joe Johnston
    If a picture is worth a 1000 words, a sample application is worth a 1000 blog entries
    The Latin root SharePoint means "as difficult as possible"
  • Re: SharePoint Webpart:Getting user information from distribution list

    05-08-2008, 4:58 AM
    • Loading...
    • Radon
    • Joined on 05-08-2008, 4:55 AM
    • Posts 1

    Hmm i just found out this thread is outdated

    Lolz wat I'm doing is on MOSS 2007 and WSS 3.0

    Big Smile 

Page 1 of 1 (9 items)