I have a module for updating a SharePoint list that takes 3 input values.
URL
List Name
CSV Path
The URL value is used by get-spweb to gain access to the site. If I set the $URL value manually and then run get-spweb $url in either Windows ps (with sharepoint snapin) or in the SP mgmt shell it returns the spsite.
If I run the module at update-list -url http://xxxx/xxx/xxx I get an error that 'A parameter cannot be found that matches parameter name ‘url’. I have tried formatting the URL as ‘http://xxx…’ and “http://xxx…” but receive the same error.
And this is going to resolve the issue of the URL not being found when used with get-spweb? And actually that is correct if you are only making the first parameter mandatory. You only have to format it as in your display if you are making multiple parameters mandatory.
@juli , as Joel mentioned, how you are invoking this code is very important here. If you are saving this as a script, then you would invoke it .\script.ps1 -url ‘…’ else as joel mentioned you will invoke it like Update-List -Url ‘…’ .
If I run the module at update-list -url http://xxxx/xxx/xxx I get an error that 'A parameter cannot be found that matches parameter name 'url'. I have tried formatting the URL as 'http://xxx...' and "http://xxx.." but receive the same error.
Is the Update-List a function you are defining somewhere? If the function is in memory, the function should take precedence over the module cmdlet, but I would change the function to something unique if possible (Update-SPList). My guess is that you when you make the call the Update-List, it is using the above reference and there is not URL param, so that is where you are seeing the error.
The interesting thing about this is it did work one time and created my items but didn’t update one of the columns because I had the wrong internal name. Once I changed that, it stopped working again.
I will certainly try changing the function name. Will report back on the progress.