List all users with full control on a SharePoint 2013 Sub site from SharePoint Object Model in C#

If I have a sub site URL and a user with Site Admin, can I list all users in that sub site that have Full Control at that level?
Any C# code sample?

Still you can do that, just pass the subsites to your code and from their you can find the users dynamically.
You could also use SPWeb.Users property to get users assigned to a subsite
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.users(v=office.15).aspx
alternatively you can also use SPWeb.SiteUsers to get all users
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.siteusers(v=office.15).aspx
other APIs of help-
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.associatedmembergroup(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.associatedownergroup(v=office.15).aspx
http://sharepoint.stackexchange.com/questions/101671/object-model-list-all-users-with-full-control-on-a-sub-site-in-sharepoint-2013
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you

Similar Messages

  • List all users with no permissions?

    Hello, is there a way to get a list of all users within a DB that have not been assigned permissions/roles?
    Thanks in advance.

    There may be a chance this users may have fixed server role.
    to get complete list you can try the below query
    DECLARE @DBuser_sql VARCHAR(4000)
    DECLARE @DBuser_table TABLE
    DBName VARCHAR(200),
    UserName VARCHAR(250),
    LoginType VARCHAR(500),
    AssociatedDatabaseRole VARCHAR(200)
    SET @DBuser_sql='
    SELECT ''?'' AS DBName,a.name AS Name,
    a.type_desc AS LoginType,
    USER_NAME(b.role_principal_id) AS AssociatedDatabaseRole
    FROM ?.sys.database_principals a
    LEFT OUTER JOIN ?.sys.database_role_members b ON a.principal_id=b.member_principal_id
    LEFT OUTER JOIN ?.sys.server_role_members c ON a.principal_id=c.member_principal_id and a.principal_id=c.member_principal_id
    WHERE a.sid NOT IN (0x01,0x00) AND a.sid IS NOT NULL AND a.type NOT IN (''C'')
    AND a.is_fixed_role <> 1 AND a.name NOT LIKE ''##%'' AND ''?'' NOT IN (''master'',''msdb'',''model'',''tempdb'')
    ORDER BY Name'
    INSERT @DBuser_table
    EXEC sp_MSforeachdb @command1=@dbuser_sql
    SELECT DBName,UserName,LoginType,
    max(case when AssociatedDatabaseRole ='db_owner' then '1' else '0' end )'db_owner',
    max(case when AssociatedDatabaseRole ='db_securityadmin' then '1' else '0' end )'db_securityadmin',
    max(case when AssociatedDatabaseRole ='db_accessadmin' then '1' else '0' end )'db_accessadmin',
    max(case when AssociatedDatabaseRole ='db_backupoperator' then '1' else '0' end )'db_backupoperator',
    max(case when AssociatedDatabaseRole ='db_ddladmin' then '1' else '0' end )'db_ddladmin',
    max(case when AssociatedDatabaseRole ='db_datareader' then '1' else '0' end)'db_datareader',
    max(case when AssociatedDatabaseRole ='db_datawriter' then '1' else '0' end) 'db_datawriter',
    max(case when AssociatedDatabaseRole ='db_denydatawriter' then '1' else '0' end )'db_denydatawriter',
    max(case when AssociatedDatabaseRole ='db_denydatareader' then '1' else '0' end )'db_denydatareader',
    max(case when AssociatedDatabaseRole is NULL then '1' else '0' end )'No Roles'
    FROM @DBuser_table
    group by DBName,UserName,LoginType
    -----Server Roles
    SELECT sp.name AS LoginName,sp.type_desc AS LoginType, sp.default_database_name AS DefaultDBName,slog.sysadmin AS SysAdmin,slog.securityadmin AS SecurityAdmin,slog.serveradmin AS ServerAdmin, slog.setupadmin AS SetupAdmin, slog.processadmin AS ProcessAdmin, slog.diskadmin AS DiskAdmin, slog.dbcreator AS DBCreator,slog.bulkadmin AS BulkAdmin
    FROM sys.server_principals sp JOIN master..syslogins slog
    ON sp.sid=slog.sid
    WHERE sp.type <> 'R' AND sp.name NOT LIKE '##%'
    OR
    You can also the refer below link
    http://consultingblogs.emc.com/jamiethomson/archive/2007/02/09/SQL-Server-2005_3A00_-View-all-permissions--_2800_2_2900_.aspx
    --Prashanth

  • Issue in treeview control along with page viewer web part showing the sub sites from MMS

    hi,
    Am having a treeview control populates  with values from  MMS - Managed Metadata Service.
    [ Products ]
    ----->ms office 
                ----->word
                ----->excel
                 ---->powerpoint
    -------->Collaboration
                     ---->   sharepoint 2003
                     ---->  moss 2007
                     ----> sp 2010
                     -----> lync
     all these  values excel, word, powerpoint are sub sites created under ms-office site collection.
    and  sharepoint 2003, mos 2007, sp 2010, sp 2013 are  sub sites created under collaboration.
    now, on the page load, end user clicks on word and he should navigate to the  sub site "wordsite"  and it should show the home page of word sub site.
    we have created a  page viewer web part and  assigned the url property of the page viewer to the sub site url.
    but the issue is, when end user clicked  on the child node "powerpoint", the  page did a Post Back and treeview control immediately collpased and it shows the Products [top level - parent node] only.
    Am unable to set the current selected value- ie  here its excel and show the excel node in the trewview.
    how can i get this child tree node as the selected node.
    help is  highly appreciated!

    Check if below can help
    http://thechriskent.com/2012/05/09/changing-the-default-expansion-of-metadata-navigation-on-initial-page-load/

  • List all users and their OUs they belong to

    Hi,
    I would like to list all users with the OU they belong to and furthermore add an specific attribute that was added...
    I can get both information separately:
    get-aduser -SearchBase 'OU=DOMAIN,DC=mygroup,DC=re,DC=lan' | FT name
    and
    Get-ADOrganizationalUnit -SearchBase 'OU=DOMAIN,DC=mygroup,DC=re,DC=lan' -properties name,budgetanalytics | FT name,budgetanalytics
    but I'd like to get the list containing user1, its OU, its budgetanalytics
    Thanking you in advance,
    Cédric

    Thanks for your reply!
    I tried the following:
    $Users = get-aduser -SearchBase 'OU=Mes Utilisateurs,DC=itced,DC=lan' -filter '*'
    $OU = $User.distinguishedname -split ',',2 | select -last 1
    $output = @()
    Foreach($User in $Users){
    $budgetanalytics = Get-ADOrganizationalUnit -SearchBase $OU -Properties objectGUID
    $Object = New-Object PSObject                                       
    $Object | add-member Noteproperty user $user.name         
    $Object | add-member Noteproperty OU $OU                       
    $Object | add-member Noteproperty objectGUID $objectGUID       
    $output += $Object
    $output
    but I get the following
    user                                             
    OU                                              
    objectGUID                                      
    User1                                            
    OU=Mon OU,OU=Mes Utilisateurs,DC=itced,DC=lan    {Microsoft.PowerShell.Commands.Internal.Forma...
    User2                                            
    OU=Mon OU,OU=Mes Utilisateurs,DC=itced,DC=lan    {Microsoft.PowerShell.Commands.Internal.Forma...
    Why do I get "Microsoft.PowerShell.Commands.Internal.Forma..." instead of the actual objectGUID of the Organizational Unit
    Thanking you in advance

  • Javascript: Query all users with read permission to specific list

    Is it possible to use javascript to retrieve all users with read permissions to specific list? This (http://www.c-sharpcorner.com/UploadFile/anavijai/how-to-get-all-the-users-from-site-group-in-sharepoint-2013/) shows how to get users from group but what
    about list. All users in list may not exist in spgoups.

    Hi,
    If with Server Object Model which is executed in server side, in the
    SPList object, there is a
    RoleAssignments property can help to get what you want without looping through all the users in site:
    public static void getPermissionsOfList()
    using (SPSite site = new SPSite("http://sp"))
    using (SPWeb web = site.RootWeb)
    SPList list = web.GetList("/Lists/List1");
    SPRoleAssignmentCollection roles = list.RoleAssignments;
    foreach (SPRoleAssignment role in roles)
    Console.WriteLine("~");
    Console.WriteLine("Name: " + role.Member.Name);
    SPRoleDefinitionBindingCollection bindings = role.RoleDefinitionBindings;
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(bindings.Xml);
    //Console.WriteLine(doc.InnerXml);
    XmlNodeList itemList = doc.DocumentElement.SelectNodes("Role");
    foreach (XmlNode currNode in itemList)
    string s = currNode.Attributes["Name"].Value.ToString();
    Console.WriteLine("Permission Level: " + s);
    However, when comes to JavaScript Client Object Model, as there is no such property provided, I suggest you take the solution provided in my previous post for a try.
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • "Sorry, you don't have access to this page" when creating a sub site. I am in the owners group with full control access

    cannot provisioning a SharePoint 2013 site with full control access, I get the page with the "Sorry, you don’t have access to this page”. Any help will be greatly appreciated.

    Hi,
    Which template did you use for the parent site?
    Please check whether the site collection administrator could create a subsite.
    Please grant permissions on the Device Channels list
    http://sitecollection_URL/DeviceChannels/AllItems.aspx -> List -> List Settings -> Permissions for this list -> granted Read rights for the Everyone group, compare the result as
    it.
    Please navigated to the hidden list "TaxonomyHiddenList" on the site collection i.e.
    http://somdnetsp/lists/TaxonomyHiddenList/AllItems.aspx and check permissions on this list. Check whether the list has unique permissions and there were no users added to the list. If yes,
    add "authenticated users" in the list permissions.
    Then, try to create sub site, compare the result.
    If this issue still exists, please check the log file to find whether there are some message about this issue.
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback
    for TechNet Subscriber Support, contact [email protected]
    Wendy Li
    TechNet Community Support

  • Find all users with deleagtion

    Hello,
    I am looking for a powershell script that will report ( csv ) on all users with delegation in the O365 environment. Any help would be appreciated.

    Hey
    This can help you:
    http://community.spiceworks.com/topic/449787-exchange-2010-list-delegate-full-access-information-for-all-users
    Regards.

  • List of users with authorised reports and tables.

    hi all
    i have another requirement, that is List of users with authorised reports and tables in SAP.
    that means user wise which reports and tables have authorisations to execute.  for that what is the tcode or table name?.  please help me in this..
    Thank you.

    Hi,
    In SUIM tcode expand transactions node der ull have for users..........
    Cheers,
    jose.

  • List all users whos password has expired

    Hi,
    Is it possible to list all users whos password has expired in the R\3 system?
    Thanks in advance,
    Aviad

    You can use program RSUSR200.
    On selection screen in block 'Selection by status of the password' select only 'Users with inactive passwords' checkbox.

  • How can I list all users who have access to a particular TABLE or VIEW

    Hi,
    Can someone tell me how I can list all users who have access to a particular TABLE or VIEW.
    Abhishek

    Hi,
    Take a look on this link: http://www.petefinnigan.com/tools.htm
    Cheers

  • Create report to list all computers with chrome or mozilla browser al editions

    Hi All,
    I have SCCM 2007 R3 and I need to create report to list all computers with chrome or Mozilla browser all editions. any help?
    Thanks,
    Kareem Behery

    The above one is SMS collection query. For SQL report you may try the below query: 
    query for IE 10
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
    from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName
    = "iexplore.exe" and SMS_G_System_SoftwareFile.FilePath
    like "%prog%internet%" and SMS_G_System_SoftwareFile.FileVersion
    like "10.%"
    query for IE 9
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
    from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName
    = "iexplore.exe" and SMS_G_System_SoftwareFile.FilePath
    like "%prog%internet%" and SMS_G_System_SoftwareFile.FileVersion
    like "9.%"
    query for IE 10
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
    from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName
    = "iexplore.exe" and SMS_G_System_SoftwareFile.FilePath
    like "%prog%internet%" and SMS_G_System_SoftwareFile.FileVersion
    like "11.%"

  • PowerShell - List all users that have access to a particular SPLIstItem

    Hi there,
    In PowerShell - how to list all users that have access to a particular SPLIstItem?
    Thanks so much in advance.

    Hi frob,
    According to your description, my understanding is that you want to list all users who have access to a particular SharePoint list item via PowerShell.
    You can use the following PowerShell command:
    $web = Get-SPWeb http://sp/sites/First
    $list=$web.Lists["listV2"]
    $item=$list.Items | where {$_['ID'] -eq 1}
    $item | Select -ExpandProperty RoleAssignments |Select {$_.Member.DisplayName}, {$_.Member.LoginName}, RoleDefinitionBindings
    In the above command, you need to change the web URL to your site's URL, change “listV2” to the name of your list, and change the ‘1’ to the ID of the list item.
    The result looks like:
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • How can I list all users and their DEFAULT tablespace?

    How can I list all users and their DEFAULT tablespace?
    Peter

    Peter, the following short article that lists the most heavily used Oracle rdbms dictionay views might be of interest based on your question:
    How do I find information about a database object: table, index, constraint, view, etc… in Oracle ? http://www.jlcomp.demon.co.uk/faq/object_info.html
    HTH -- Mark D Powell --

  • How to list all user's "followed" count?

    Dear all,
    I need to genearate a report to list all user's Followed items count.
    I found follow REST API:
    http://msdn.microsoft.com/en-us/library/dn194080.aspx#bk_FollowedCount
    By using "My/followedcount", I can get current user's count of items he or she followed. It is exactly what I need. But I need to list all users' "following count". How can I do it?
    Thank you for any input.
    Mark

    Hi Mark Lui,
    Please check the code sample in below article, whether it is working in your scenario, it is using the client object model to get the specified user’s followed content, to get all users’ following content, please first iterate users information, then use
    this to get followed count:
    How to get Count and List of documents and sites followed by a User in Office 365 SharePoint 2013 Site using CSOM:
    http://sundarnarasiman.net/?p=186
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Retrieve all users with attributes from AD

    hi,
    i'd like to retrieve all users with their attributes from AD. I can connect to AD and i 'm able to retrieve entries from a group with the member class given in this forum.
    But my problem is i would like to retrieve users directly from the Users container
    thanx for help

    i solved one part of my problem.
    But, now i have to get all attributes for each users and i couldn't find them. The getattributes method doesn't return anything (i 'd like to retrieve the first name, last name, adress ...)
    thanx for help

Maybe you are looking for

  • Hey i hav an hp pavilion g series n i would like to kno how use the function keys without having to

    hey i hav an hp pavilion g series n i would like to kno how use the function keys without having to click on the fn + function key

  • 11G Memory Issue - ORA-01438

    We have begun playing with OLAP for Oracle 11G. So far we have noticed this error popping up from time to time. ORA-01438: value larger than specified precision allowed for this column. We have generated this error when trying to return a large ammou

  • Problem while releasing invoice to accounting

    Hello, When I try to release a debit memo to accounting (VF02), the system throws the following error: Account type/account for invoice reference does not match item Message no. F5350 Any pointers on how to solve this please? Thanks, Shankar

  • Allow user to resize window vertically only

    Hi, I have a JFrame that I want the user to be able to resize vertically, but not horizontally ~ how do I implement that functionality? Also, is there away to remove the maximize button from the Title Bar but maintain the minimize button? Thanking yo

  • Minimum font

    How do I increase the minimum font size Lion uses?