Sunday, May 29, 2016

Get "Created By" User Field Values in SharePoint using PowerShell

Requirement:
Sometimes, You may to retrieve the User details such as User's Email, Account ID, Full name, etc from the Created by field. Here is the PowerShell script to get created by field values in SharePoint.

PowerShell to "Get Created By" Field Value in SharePoint:

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
 
#Configuration Parameters
$WebURL = "http://portal.crescent.com/IQ/"
$ListName = "Questionnaire"
$ItemID = "147"
 
#Get the Web, List, Item objects
$Web= Get-SPWeb $WebURL
$List= $web.Lists[$ListName]
$Item = $List.GetItembyID($ItemID)
 
#Get the "created by" Field value
$Author = New-Object Microsoft.SharePoint.SPFieldUserValue($web, $Item["Author"])

#Get Email ID from Created By
$Author.user.Email
#Get Login ID
$Author.User.LoginName
#Get Created By Full Name
$Author.User.Name



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...