none
XML into SharePoint List

    Question

  • Hello everyone,

    Is it possible to get from an XML file an object with properties in PowerShell? And then I would like to take this object and insert it into a SharePoint List. Is this possible? Should I write my powershell within VS or is the PowershellGUI good enough?

    How to make this connection?

    Greetings,

    SpaceLama

    Thursday, April 12, 2012 7:51 PM

Answers

  • SpaceLama

    First off, powerGUI is much better IDE for Powershell than VS. 

    Could please give us so more information, what version of SharePoint are we taking about 2010, 2007/3.0

    to get an XML object in Powershell from a XML file is ez

    [xml]  $x = [xml] $(gc "FULL PATH TO XML FILE") 

    where

    gc is alias for Get-Content

    $x will become System.XML.XMLDocument object

    from here to get into SharePoint list it all depends on SP version. 

    2007/3.0 I perfer to use the list services via the New-WebServiceProxy cmdlet as it can run remotely and not on the SP server.

    For 2010 try this link

    http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/22/use-powershell-to-manage-lists-views-and-items-in-sharepoint.aspx

    Bri

     

    
    
    
    
    
    
    
    

    Brian Jon Hopenwasser MSTS: TFS 2010 Admin MSTS: TFS 2005 Developer

    Thursday, April 12, 2012 8:43 PM