Get to Lines object in PowerShell

SOLVED

Hi Experts,

am working on a data import into Sage 100 in PowerShell through BOI. It works fine. The one problem I have is to get to Lines Objects.

In VBScript i used the following line to get a handle for the oLines object:

Set oLines = oSession.AsObject(oHeader.Lines)

Does anyone know how that would look like in PowerShell. I have $oSS as the SY_Session Object and I have $oAPInv as the Invoice Object (AP_Invoice_Bus).

I am able to log into Sage, create my Invoice Batch, work through the Invoice Header, but now I need to deal with the lines.

Thanks for your help!

Parents Reply
  • +1 in reply to David Speck
    verified answer

    Yes, I am using the BUS object. The nLines doesn't work either. But I looked into the Dispatch Object for C# and got some help on StackOverflow. Here is how I can access the Lines in PowerShell:

    $m_flgGetProperty = [System.Reflection.BindingFlags]::Public + [System.Reflection.BindingFlags]::Static + [System.Reflection.BindingFlags]::IgnoreCase + [System.Reflection.BindingFlags]::GetProperty
    $oAPInvLines = $oAPInv.GetType().InvokeMember("oLines", $m_flgGetProperty, $null, $oAPInv, $null)

    Thanks for your help!

Children