Search code examples
powershellsharepointsharepoint-2010powershell-2.0

Format SharePoint's <properties> node as list


SharePoint 2010's listdata.srv service returns an Atom feed for a given picklist:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://apps/Requests/_vti_bin/listdata.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schem as.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/&quot;28&quot;" xmlns="http://www.w3.org/2005/Atom">
...
  <content type="application/xml">
    <m:properties>
      ...
      <d:Name>Last, First</d:Name>
      <d:WorkEMail>first.last@domain</d:WorkEMail>
      ...
    </m:properties>
  </content>
</entry>

I would like to have quick way to display all of the nodes in the /entry/content/properties node in a list.

I've tried:

PS> Get-Url "http://apps/Requests/_vti_bin/listdata.svc/List(1234)/Requestor" | Format-List -Property entry.content.properties

But this doesn't return a value.

This works, but I'd like to avoid the interim variable assignment step:

    [xml]$xml = Get-Url "http://apps/Requests/_vti_bin/listdata.svc/List(1234)/Requestor"
    $xml.entry.content.properties

What is the proper syntax?


Solution

  • What about this? ([xml](Get-Url "...")).entry.content.properties