对于PowerShell来说,我仍然是个新手,我试图把我所有OneNote页面的列表和Notebook...and都放到一个CSV中。我就快完成了,但最后的部分还在躲避我。我尝试过以下几种方法:
我正在使用https://github.com/wightsci/OneNoteUtilitiesGraph
# This my 'ffmpeg etc' Section. Get its Page(s) info:
$sPages = Get-MgUserOnenoteSectionPage -OnenoteSectionId "0-nnnn" -UserId "bbbb@yyyy.com"
# What do we have available to us?
$sPages | Get-Member显示(子集):
Title Property string Title {get;set;}
CreatedDateTime Property System.Nullable[datetime] CreatedDateTime {get;set;}
ParentSection Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphOnenoteSection ParentSection {get;set;}所以最后一个是对象中的对象??无论如何,随机选择一些并检查一些值
$sPages[3].Title
Cut a video (lossless) with no re-encoding
$sPages[3].ParentSection.DisplayName
ffmpeg etc但
Foreach($s in $sPages) { $s | select Title, CreatedDateTime,ParentSection.DisplayName }对ParentSection.DisplayName没有任何价值:
Title CreatedDateTime ParentSection.DisplayName
----- --------------- -------------------------
Powershell (ffmpeg) to split media file by times.csv 28/10/2020 10:01:02 AM
Series of numbered images to a video 6/04/2019 9:35:33 PM
Fuji camera - Timelapse (of cool change, clouds) 6/04/2019 9:36:27 PM这样做的正确方法是什么,特别是如果我想要将这3个属性值保存到CSV文件中?谢谢。
发布于 2021-10-03 10:54:05
您需要一个calculated property来获取同一对象的ParentSection as属性的Displayname
尝试:
foreach($s in $sPages) {
$s | Select-Object Title, CreatedDateTime,
@{Name = 'ParentSection'; Expression = { $_.ParentSection.DisplayName }}
}https://stackoverflow.com/questions/69422731
复制相似问题