Get-KFUserInfo

Syntax

Get-KFUserInfo
  -UserField <field-name>
  [-Item <list-item-object>]
  [-ThrowErrors[:$true]]
Get-KFUserInfo
  -UserName <user-name>
  [-Item <list-item-object>]
  [-ThrowErrors[:$true]]
Get-KFUserInfo
  -User <User-object>
  [-Item <list-item-object>]
  [-ThrowErrors[:$true]]
Get-KFUserInfo
  -UserFieldValue <FieldUserValue-object>
  [-Item <list-item-object>]
  [-ThrowErrors[:$true]]
Get-KFUserInfo
  -UserId <user-id>
  [-Item <list-item-object>]
  [-ThrowErrors[:$true]]

Support

>= kenaflow 1.0

Return

PowerShell Hashtable.

Description

This cmdlet is only available in SharePoint workflows!

This cmdlet retrieves information about the user from the SharePoint profile store.

The profile store is operated by the "User Profile Service Application". This does not exist in SharePoint Foundation 2013 - that is basically supported by kenaflow. Likewise, the cmdlet does not work for this edition of SharePoint.

There are several ways to retrieve the information for a user. Either

  • via the username by -UserName, e.g. kenaflow\testuser (sAMAccountName with domain) or testuser@kenaflow.com (userPrincipalName) or

  • via a named field with -UserField in the currently processed SharePoint list item or the list item specified by -Item , e.g. Author or Editor (both standard fields of SharePoint list items)

  • via the user ID with -UserId, where a user's ID has nothing to do with the SID in Active Directory, but is specific to each user and each SharePoint Site Collection, e.g. 1 or 15, or

  • via an user object with -User or

  • via the a given field value with -UserFieldValue.

The returned object will then provide various user information, depending on what is stored in the SharePoint profile system or imported from Active Directory and/or other sources.

The return object looks like this:

Name                               Value
----                               -----
SPS-PersonalSiteInstantiationState 2
SPS-StatusNotes
ADGuid
SPS-ObjectExists
SPS-MasterAccountName
SPS-PictureExchangeSyncState
Department
SPS-SourceObjectDN
SPS-HashTags
SPS-Peers
WorkPhone
SPS-SavedSID                       System.Byte[]
PictureUrl
SPS-HireDate
SPS-PrivacyPeople                  False
SPS-Skills
SPS-MySiteUpgrade
LastName
SPS-PrivacyActivity                0
SPS-JobTitle
PublicSiteRedirect
DirectReports                      {}
Manager
SPS-PhoneticDisplayName
PersonalSpace                      /personal/ingo/
UserProfile_GUID                   553bd20e-df46-4237-bd2f-b15340518d63
SPS-SavedAccountName               SHAREPOINT\ingo
DisplayName                        Ingo
LatestPost
SPS-ResourceAccountName
SPS-PersonalSiteCapabilities       14
SPS-EmailOptin                     0
WorkEmail
SPS-Location
SPS-ClaimProviderType              Windows
Assistant
HomePhone
IsFollowed                         False
SPS-School
SPS-ClaimProviderID                Windows
AboutMe
AccountName                        SHAREPOINT\ingo
SPS-PhoneticFirstName
SPS-O15FirstRunExperience
PersonalUrl                        https://intranet13.sharepoint.farm/personal/ingo/
CellPhone
SPS-Responsibility
ExtendedReports                    {SHAREPOINT\ingo}
SPS-ProxyAddresses
SPS-ClaimID
SPS-PictureTimestamp
SPS-PastProjects
SPS-Department
WebSite
Title
FirstName
PreferredName                      Ingo
SPS-TimeZone
SPS-Interests
UserUrl                            https://intranet13.sharepoint.farm:443/msh/Person.aspx?accountname=SHAREPOINT%5Cingo
SPS-Birthday
SPS-SipAddress
SPS-DisplayOrder
SPS-Dotted-line
Office
UserName                           ingo
SPS-FeedIdentifier                 https://intranet13.sharepoint.farm/personal/ingo;1.a2cf9b4cd9714727bf0b18876689e4b7.243d067e81744aad96c6ee849a72c3e4.b8a0...
Email
Fax
SPS-UserPrincipalName              ingo@sharepoint.farm
SPS-PicturePlaceholderState
Peers                              {}
SPS-ResourceSID
ExtendedManagers                   {}
SPS-PhoneticLastName
SID                                S-1-5-21-332261926-3817531067-2902869885-1115
PictureURL
SPS-DistinguishedName              CN=Ingo,OU=kenaflow,DC=sharepoint,DC=farm

Parameters

[-Item <list-item-object>]

The item to be used. If nothing is specified here the currently processed list item is used. In a site workflow there is no list item. Then you have to specify it yourself. (See 3rd example below.)

-UserField <field-name>

The name of a user field.

-UserName <user-name>

The name of a user. sAMAccountName with domain or user principal name.

-User <User-object>

A SharePoint user object.

-UserFieldValue <FieldUserValue-object>

A SharePoint user field value (Type Microsoft.SharePoint.Client.FieldUserValue).

-UserId <user-id>

The SharePoint site specific id of a user.

[-ThrowErrors[:$true]]

This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.

Example

Get-KFUserInfo -UserField "Author"
Get-KFUserInfo -UserFieldValue $item["Author"]
$item = Get-PnpListItem -List "Custom List" -Id 1
$user = Get-KFUser "{{Author}}" -Item $item
Get-KFUserInfo -UserId $user