我正在关注Get metadata for a list的文档 .
使用PowerShell或Graph Explorer查询无法完全展开SharePoint列表中项目的字段 .
一个示例是名为 Responsible
的查找字段,用于在Azure Active Directory中查找用户(或者在SharePoint术语中,该列是 Person or Group
列,仅限于人员) .
一旦通过GUI选择,'s populated with a display name (although I' d希望将更多权威信息存储在后端,如 UPN
) .
使用以下格式查询Graph API时:
$Uri = "https://graph.microsoft.com/v1.0/sites/$($SPSite.id)/lists/$($ServiceList.id)/items?expand=fields"
$Data = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} -Uri $Uri -Method Get -ErrorAction Stop
我们得到这样的东西:
@odata.etag : "REMOVED"
Title : Storage Platform
Description : Central storage platform
ResponsibleLookupId : 14
Responsible2LookupId : 13
AccountableLookupId : 3
Features : NFS
AudienceLookupId : 92
RequestProcess : {@{LookupId=1; LookupValue=Service Desk}}
Support : {@{LookupId=1; LookupValue=Service Desk}}
AvailabilityLookupId : 1
DependsOn : {}
O365GroupLookupId : 87
LifecycleStageLookupId : 2
ConsultLookupId : 88
id : 1
ContentType : Item
Modified : 2017-11-17T10:47:07Z
Created : 2017-11-17T10:47:07Z
_UIVersionString : 1.0
Attachments : False
Edit :
LinkTitleNoMenu : Storage Platform
LinkTitle : Storage Platform
ItemChildCount : 0
FolderChildCount : 0
_ComplianceFlags :
_ComplianceTag :
_ComplianceTagWrittenTime :
_ComplianceTagUserId :
你可以看到 ResponsibleLookupId
字段只给出 14
的值,这是没用的 . 其他字段链接到Office 365组,但再次返回值 . 因此,不可能将任何此类数据链接到用户/组,并且除了通过门户网站查看之外,其 Value 非常有限 .
我们如何扩展这些数据?它是否会在以后通过API调用提供,还是我们必须进行进一步的查找?
1 回答
默认情况下,Microsoft Graph将返回
LookupId
用于查找字段 . 您可以通过在$select
参数中专门请求该字段来要求它提供实际值 .使用以下查询将返回
displayName
而不是LookupId
forResponsible
:您可以在FieldValueSet的文档中了解其工作原理 .
至于返回
userPrincipalName
,目前您可以't control which value it returns (it' sLookupId
或displayName
) . 我建议您访问UserVoice并添加您的建议 .