探索@ odata.NextLink

时间:2018-03-14 16:02:41

标签: powershell

我将此作为变量: enter image description here

我需要访问@ odata.nextLink;我试着通过这样做而没有运气来调用它:

$messages2 = Invoke-RestMethod $messages.odatanextLink -Credential $cred

我也试过这个但它失败了:

$messages2 = Invoke-RestMethod $messages.@odata.nextLink -Credential $cred

之前的代码是:

$url = "https://outlook.office365.com/api/v1.0/me/messages" 
$date = Get-Date -Format "yyyy-MM-dd"

$messageQuery = "" + $url + "?`$select=Id&`$filter=HasAttachments eq true and DateTimeReceived ge " + $date
$messages = Invoke-RestMethod $messageQuery -Credential $cred 

foreach ($message in $messages.value) 
{

1 个答案:

答案 0 :(得分:1)

在PowerShell中,您可以使用引号安全地限定成员名称:

$messages2 = Invoke-RestMethod $messages.'@odata.nextLink' -Credential $cred