Tag Info

New answers tagged

0

This Script will get all the security groups listed in your groups at web level,similarly you can get if principal is Distribution list or a user or a Sharepoint Group POWERSHELL if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } Write-Output "Starting ...


0

You could try Azure AD Graph REST API for that purpose, in particular Get User(s) operation, for example: GET https://graph.windows.net/contoso.onmicrosoft.com/users?api-version=2013-04-05 HTTP/1.1 Authorization: Bearer eyJ0eX ... FWSXfwtQ Content-Type: application/json Host: graph.windows.net


0

it is unsupported to query SharePoint’s databases directly and should not be done in production without the direct involvement of a Microsoft support engineer.Every Content DB has a User info table which contains the user information. Groups are stored in the same content database where the site Collection reside.So, Once you get the site collection DB ...


0

You either open the Central Admin to find the Database Details. Or you can use below PowerShell script. Get-SPContentDatabase -site http://siteurl


1

You can create a subsite under site collection, which will be a parent subsite, and then your other subsites can be children subsites to the newly created parent subsite under site collection, In this way you can define groups at parent subsite which can be inherited by all child subsites OR you can break permission at all level and Run this script to give ...


2

function CheckMemberInAdminGroup() { var clientContext = new SP.ClientContext.get_current(); this.currentUser = clientContext.get_web().get_currentUser(); clientContext.load(this.currentUser); this.userGroups = this.currentUser.get_groups(); clientContext.load(this.userGroups); clientContext.executeQueryAsync(success, failure); } ...


1

You could call /Web/SiteGroups with multiple $filter values, e.g., _api/Web/SiteGroups?$filter=Title eq 'GroupA' or Title eq 'GroupB' Afterwards you would have to cross-reference results with your own names, e.g., with underscore: _.difference(yourGroupNames, _.pluck(groups, 'Title'))


1

At a glance, if you do not wish to add permissions to the group, don't! Just do this part: foreach($groupName in $DisciplineGroups) { if ($mRootWeb.SiteGroups[$groupName] -ne $null) { Write-Host "Group "$($groupName)" already exists!" Break; } else { $mRootWeb.SiteGroups.Add($groupName, ...


0

Amal helped and I used his code as a start, but this is the full answer. I also switched to getting the folder name instead of ID, that I pass in as fldrName: using (SPSite site = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb web = site.OpenWeb("/Docs/") { SPDocumentLibrary docList = (SPDocumentLibrary)web.Lists["Documents"]; ...


1

if (fldrItem.RoleAssignments.Count > 0) { SPRoleAssignmentCollection assignColl = fldrItem.RoleAssignments; foreach (SPRoleAssignment assignment in assignColl) { if(assignment.Member.Name == group.Name) { //Now you can look into the associated RoleDefinitions from assignment } } }


1

You can simply create the Event receiver as explained in example here : How to create a custom list level event receiver in SharePoint 2013 and SharePoint 2010 Or the other example you can use here: Creating a simple Event Receiver in SharePoint 2013. Once you create the event receiver, you can place code of adding current user to group, see this link ...


1

You need to two event handlers Attached to the List You need to ItemUpdated and ItemAdded events Attached to SharePoint User Events - SPSecurityEventReceiver class was introduced to help developers add Event Handlers around SharePoint Groups, Users, Roles and Permission Inheritance. You can create this handler in a Feature Receiver ...


0

You can do it as SPGroup g = //Populate it SPUser u = web1.EnsureUser("DOMAIN\\TheOwners"); g.AddUser(u);


1

$spWeb = Get-SPWeb "https://spdev" $GroupName="Group 1" if($spWeb.SiteGroups[$GroupName] -ne $null) { $spWeb.SiteGroups.Remove($GroupName) $spWeb.Update() Write-Host "Group Deleted!" } else { Write-Host "Group doesn’t Exists!" }


0

You can do this using $web = Get-SPWeb "http://siteurl" $groups = $web.SiteGroups $g = ("Group1") ForEach($group in $g) { $groups.Remove($group) } $web.Dispose()



Top 50 recent answers are included