Getting permissions of a user in SharePoint 2K3 List

902 views Asked by At

I have been using SharePoint server 2003. I need to retrieve the list of permissions using SPList.Permissions.Xml. But I dont find the permissions given to the user anywhere in the Xml returned.

Say I have a user 'A' whose Login name comes as an attribute in the Xml. But the permissions (such as View, View&Insert, View&Insert&Delete etc.,).

I do not want the site level permissions as they can be retrieved using SPSite.Roles. I need to get the permissions of the SPList alone. Any help would definitely be appreciated (befittingly!! :) )

Note that I am using SP 2003 (Not SP2007 where RoleAssignments can be used to get these details)

1

There are 1 answers

0
Rubens Farias On BEST ANSWER

Once upon a time I wrote a code like this:

SPDocumentLibrary source = (SPDocumentLibrary)web.Lists["source"];
SPDocumentLibrary target = (SPDocumentLibrary)web.Lists["target"];
foreach(SPPermission permission in source.Permissions)
{
    try
    {
        target.Permissions.Add(permission.Member, permission.PermissionMask);
    }
    catch { } // "ask rumen for info"
}

As it shows how to navigate in permissions collection and how to copy them, I hope it helps.