Skip to main content
improved formatting
Source Link
Asad Refai
  • 6k
  • 8
  • 35
  • 57

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains

  • Date Opened,
  • Date Closed
  • Days Open and
  • Today columns.

If there is a

Date Closed date, then Days Open = Date Closed-Days Open.

Date Closed date, then Days Open = Date Closed-Days Open.

Else

Days Open = Today-Date Created.

Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains

  • Date Opened,
  • Date Closed
  • Days Open and
  • Today columns.

If there is a

Date Closed date, then Days Open = Date Closed-Days Open.

Else

Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains

  • Date Opened,
  • Date Closed
  • Days Open and
  • Today columns.

If there is a

Date Closed date, then Days Open = Date Closed-Days Open.

Else

Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains Date Opened, Date Closed and Days Open columns, and a "Today" column. If

  • Date Opened,
  • Date Closed
  • Days Open and
  • Today columns.

If there is a Date Closed date, then Days Open = Date Closed-Days Open.

Date Closed date, then Days Open = Date Closed-Days Open.

Else Days Open = Today-Date Created.

Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains Date Opened, Date Closed and Days Open columns, and a "Today" column. If there is a Date Closed date, then Days Open = Date Closed-Days Open. Else Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains

  • Date Opened,
  • Date Closed
  • Days Open and
  • Today columns.

If there is a

Date Closed date, then Days Open = Date Closed-Days Open.

Else

Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.

Source Link

"Cannot index into a null array" and "Invoke method on null" errors

I am new to SharePoint 2013 and am not a coder.

I have a List, "IRM Summary", that contains Date Opened, Date Closed and Days Open columns, and a "Today" column. If there is a Date Closed date, then Days Open = Date Closed-Days Open. Else Days Open = Today-Date Created.

This is working fine except that in SharePoint 2013, as I've found out, Today needs to be updated via a script and nightly scheduled task.

I've found the code below online (and several variations of it) and have adapted the names to our environment.

Start-SPAssignment -Global
$web = Get-SPWeb http://mysite/sites/IRM
$list = $web.Lists[“IRM Summary”]
$list.Items | ForEach-Object {
$_[“Today”] = [System.DateTime]
$_.SystemUpdate($false)
$list.Update()
}
$web.Dispose()
Stop-SPAssignment -Global

However, when I run it in SharePoint 2013 Management Shell, I get the following errors:

Cannot index into a null array. At C:\SPListItemsWithTodaysDate.ps1:26 char:1

  • $_["Today"] = [System.DateTime] #Replace TodaysDate with your field name
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:27 char:1

  • $_.SystemUpdate($false)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression. At C:\SPListItemsWithTodaysDate.ps1:28 char:1

  • $list.Update()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

The list itself is populated, and currently there are values in the Today column for every row in the list.

Any help would be appreciated, either with "fixing" the script or using another (non-Javascript) solution or workaround.