如何使用 PowerShell 将 REST API 答案转换为正确的 XML?

How do I convert a REST API answer to proper XML using PowerShell?

我正在尝试使用 PowerShell 解析 SharePoint 网站中使用的标识名称。

请求很简单:

(Invoke-WebRequest -Uri https://<siteaddress>/_api/web/SiteLogoUrl -UseDefaultCredentials).content

生成 xml

<?xml version="1.0" encoding="utf-8"?>
<d:SiteLogoUrl xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
    xmlns:georss="http://www.georss.org/georss"
    xmlns:gml="http://www.opengis.net/gml">/<sitepath>/SiteAssets/Logo_name.jpg</d:SiteLogoUrl>

但是,尝试将其转换为 XML 只会创建“空”数据

[xml]((Invoke-WebRequest -Uri https://<siteaddress>/_api/web/SiteLogoUrl -UseDefaultCredentials).Content).SiteLogoUrl

哦,愚蠢的我...

([xml](Invoke-WebRequest -Uri https://<siteaddress>/_api/web/SiteLogoUrl -UseDefaultCredentials).Content).SiteLogoUrl
d      : http://schemas.microsoft.com/ado/2007/08/dataservices
m      : http://schemas.microsoft.com/ado/2007/08/dataservices/metadata
georss : http://www.georss.org/georss
gml    : http://www.opengis.net/gml
#text  : /<SITEPATH>/SiteAssets/Logo_name.jpg