admin管理员组文章数量:1335861
I am using Microsoft GraphAPI to query a SharePoint list. The list has a field called Buyer. When I query a record for that buyer field, what is returned is a number associated with the user in the list permissions.
$ListitemConnection = Get-MgSiteListItem -SiteId $siteId -ListId $listId -ListItemId $ItemId -ExpandProperty "fields" -Property *
$ListitemDetails = $ListitemConnection.Fields.AdditionalProperties
$BuyerID = $ListitemDetails.BuyerLookupId
So in the above code $BuyerID will return a number such as "45". I would like to convert that number to the person's email address but am unsure how. I looked at the Get-MgUser command but that does not use the PropertyNameLookupID to find the user.
In case it matters, I am connecting to graph using an Azure appID/secret and our tenant.
Connect-MgGraph -ClientSecretCredential $ClientSecretCredential -TenantId $TenantID -NoWelcome
I would prefer to stick to a solution that only uses GraphAPI and does not require the use of PNP.PowerShell.
Can anyone offer a suggestion?
I am using Microsoft GraphAPI to query a SharePoint list. The list has a field called Buyer. When I query a record for that buyer field, what is returned is a number associated with the user in the list permissions.
$ListitemConnection = Get-MgSiteListItem -SiteId $siteId -ListId $listId -ListItemId $ItemId -ExpandProperty "fields" -Property *
$ListitemDetails = $ListitemConnection.Fields.AdditionalProperties
$BuyerID = $ListitemDetails.BuyerLookupId
So in the above code $BuyerID will return a number such as "45". I would like to convert that number to the person's email address but am unsure how. I looked at the Get-MgUser command but that does not use the PropertyNameLookupID to find the user.
In case it matters, I am connecting to graph using an Azure appID/secret and our tenant.
Connect-MgGraph -ClientSecretCredential $ClientSecretCredential -TenantId $TenantID -NoWelcome
I would prefer to stick to a solution that only uses GraphAPI and does not require the use of PNP.PowerShell.
Can anyone offer a suggestion?
Share Improve this question edited Nov 19, 2024 at 21:29 Mark D. MacLachlan asked Nov 19, 2024 at 21:21 Mark D. MacLachlanMark D. MacLachlan 113 bronze badges1 Answer
Reset to default 0After a lot of searching I finally found what I needed.
$ItemID = $Listitem.Id
$ListitemConnection = Get-MgSiteListItem -SiteId $siteId -ListId $listId -ListItemId $ItemId -ExpandProperty "fields" -Property *
$ListitemDetails = $ListitemConnection.Fields.AdditionalProperties
$BuyerID = $ListitemDetails.BuyerLookupId
# Get the User Information List
$UserList = Get-MgSiteList -SiteId $SiteID -Filter "DisplayName eq 'User Information List'" -Select Id
# Get the user details using the LookupId
$User = Get-MgSiteListItem -SiteId $SiteID -ListId $UserList.Id -ListItemId $BuyerID -Select "fields" -ExpandProperty "fields"
# Extract the email address
$BuyerEmail = $User.Fields.AdditionalProperties.UserName
本文标签: powershellReturn Email Address from SharePoint PeopleGroup using GraphAPIStack Overflow
版权声明:本文标题:powershell - Return Email Address from SharePoint PeopleGroup using GraphAPI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742397600a2467238.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论