Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Check if user exists in SharePoint group using powershell

$
0
0

Hi,

I am adding the users to the SharePoint group as below

$user = $web.Site.RootWeb.EnsureUser($username)

$ownerGroup = $web.SiteGroups["groupname"]

$ownerGroup.AddUser($user)

But i want to test if user is already available in group.

If user is available,want to display the message as user already exists.

But may i not the possibilities of checking if user is available in the SharePoint group.

Please provide your inputs on the same.

Regards,

Sudheer


Thanks & Regards, Sudheer


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>