none
How do I call two csv files into ews? RRS feed

  • Question

  • I have to call two csv files into a script with ews:

    Param([string]$calInputFile = "C:\Algemene agenda\Data docenten.txt" )
    Param([string]$calMailboxFile ="C:\Algemene agenda\Alle docenten.txt"
    # Load all Entries
    $calagenda = Import-Csv $calInputFile
    $calMailbox = Import-Csv $callMailboxfile

    This do not work.

    How can I do this???

    Wednesday, May 14, 2014 8:18 AM

All replies

  • How are you determining that this didn't work?  The $CalAgenda variable should have the information from the $CalInputFile file and the $CalMailbox variable should have that of the $CalMailboxFile file, but this code doesn't display anything to show what is in these two variables.

    Wednesday, May 14, 2014 12:32 PM
  • With 1 param it go well. But with two param I get an error:

    Param : The term 'Param' is not recognized as the name of a cmdlet, function, script file, or operable progra
    m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At C:\Users\beheer\AppData\Local\Temp\1\859c5f8f-d6d0-4a52-955e-6e3ce99d1b30.ps1:2 char:1
    + Param([string]$calMailboxFile = "C:\Algemene agenda\Alle docenten.txt")
    
    How can I resolve this???

    Thursday, May 15, 2014 10:10 AM
  • The second line

    Param([string]$calInputFile = "C:\Algemene agenda\Data docenten.txt" )
    Param([string]$calMailboxFile ="C:\Algemene agenda\Alle docenten.txt"

    does not have a closing bracket like the first. Maybe something to do with that?


    OWA For SmartPhone

    Thursday, May 15, 2014 11:34 AM
  • OH!!  Why didn't I see this before?  s-:  You are having problems with the Param definition, but it appears you are having troubles pulling the data into the script.  You can only have a single Param definition for a script.  Try the following instead:

    Param(
        [string]$calInputFile = "C:\Algemene agenda\Data docenten.txt",
        [string]$calMailboxFile ="C:\Algemene agenda\Alle docenten.txt"
    )
    ## Load all Entries
    $calagenda
    = Import-Csv $calInputFile
    $calMailbox
    = Import-Csv $callMailboxfile

    To define multiple parameters, you have your Param definition (with its parentheses) and all parameters are defined inside it, separated by commas.


    Thursday, May 15, 2014 11:58 AM
  • Thanks   Willard Martin

    This was the solution

    Thursday, May 15, 2014 1:02 PM
  • Would you be willing to mark it as such?  And again, I'm sorry I didn't see it from your first posting - I was focused on the "import two CSVs", rather than the fact we were looking at a script and you were passing parameters to it.  My bad ...
    Thursday, May 15, 2014 3:11 PM