I have this line:
get-pnpgroupmembers -identify "visitors group" | select title, email
The code above gives me all members of the visitors group. I found the column Title and email, how can I find the other columns?
P
I have this line:
get-pnpgroupmembers -identify "visitors group" | select title, email
The code above gives me all members of the visitors group. I found the column Title and email, how can I find the other columns?
P
For most PowerShell cmdlets, try something like this:
get-pnpgroupmembers -identity "visitors group" | select *
or
get-pnpgroupmembers -identity "visitors group" | Get-Member
As the PNP cmdlets are not populating all of the CSOM properties, you will get an error with "select *", and selecting some of the properties returned by Get-Member like Alerts and Groups will return errors.
While not of the properties all are useful, these are selectable:
AadObjectId, Email, Id, IsEmailAuthenticationGuestUser, IsHiddenInUI, IsShareByEmailGuestUser, IsSiteAdmin, LoginName, ObjectVersion, Path, PrincipalType, ServerObjectIsNull, Tag, Title, TypedObject, UserId
get-pnpgroupmembers -identity "visitors group" | select AadObjectId,
Email,Id,IsEmailAuthenticationGuestUser,IsHiddenInUI,IsShareByEmailGuestUser,
IsSiteAdmin,LoginName,ObjectVersion,Path,PrincipalType,ServerObjectIsNull,
Tag,Title,TypedObject,UserId
As you will see, there aren't too many columns to choose from. What data are you looking for? You may need to query the User Profile Services for more user data.
I don't know the exact number of user properties in each sharepoint version. But you can use below links to see the list of default user profile properties in SharePoint 2010,2013 and Office 365. Using this properties you can query your groups.
Sources:
Using 3rd link, follow the steps given and you can navigate to "Manager User Properties" in SharePoint admin center. Where you can see the basic default user profile properties.
In general you can use wildcards (*
) with the select
pipe. This works with any variable that has properties. To select ALL properties and see what their values are you can do something like the following:
get-pnpgroupmembers -identify "visitors group" | select *
Unfortunately if you have a lot of items in your pipeline from get-pnpgroupmembers
you'll get spammed with every property from each item. So if you want to find some specific columns for your object type you could call the function below, find your columns, and replace the * -first 1
with your comma separated list of columns.
get-pnpgroupmembers -identify "visitors group" | select * -first 1
An easy example:
Get-ChildItem . | select * -First 1
and turned it into the following, after selecting which columns I needed:
Get-ChildItem . | select BaseName,LastWriteTime,Attributes