You cannot call a method on a null-valued expression (powershell, sharepoint) -


i created powershell script purpose of reading text document , applying changes field in sharepoint environment. sorry errors in technical jargon im starting out , still learning. heres script:

  $data = get-content "e:\projects.txt"   write-host $data.count total lines read file   foreach ($line in $data)   {   write-host $line   $web = get-spweb -identity "http://bizprojectsqa.westerncape.gov.za/pwa/"   $list = $web.getlist($line)   $query = "<where><eq><fieldref name='status'/><value type='text'>(2)active</value></eq></where>"       $view = $list.views["all active risks"]   $view.query = $query   $view.update();   }  

heres error message:

 cannot call method on null-valued expression.  @ c:\temp\pwa_risks.ps1:12 char:13  +$view.update <<<< (); +categoryinfo         : invalidoperation: (update:string) [], runtimeexception  +fullyqualifiederrorid : invokemethodnull 

i think has $view.update() im not 100% sure.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -