title: Powershell property 'timestamp' cannot be found on this object
body: <p>Using Powershell version 5, I am writing a Powershell module, <code>HandleReports.psm1</code> that has a class, <code>CodeReview</code>. Separately, I am writing a Powershell script, <code>HandleReports.tests.ps1</code> to test the module.
  The issue I am facing, is the following error message:</p>
  <pre><code>The property 'timestamp' cannot be found on this object. Verify that the 
  property exists and can be set.
  At C:\MyFolder\HandleReports\HandleReports.psm1
  :18 char:5
  +     $this.timestamp = $timestamp
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : PropertyAssignmentException
  </code></pre>
  <p><code>HandleReports.psm1</code> has the following class definition:</p>
  <pre><code>class CodeReview {
    CodeReview ([string] $timestamp) {
      $this.timestamp = $timestamp
    }
  }
  </code></pre>
  <p><code>HandleReports.tests.ps1</code> has the following content:</p>
  <pre><code>Using module C:\MyFolder\HandleReports\HandleReports.psm1
  
  $MyTimestamp = Get-Date -Format o | ForEach-Object { $_ -replace &quot;:&quot;, &quot;.&quot; }
  
  $MyCodeReview = [CodeReview]::new($MyTimestamp)
  </code></pre>
  <p>I have tried resolving this issue by:</p>
  <ul>
  <li>casting the timestamp to string type</li>
  <li>modifying the class constructor</li>
  <li>Instantiating the class inside the module itself</li>
  </ul>
  <p>Also, comparing to:</p>
  <p><a href="https://learningintheopen.org/2020/05/07/powershell-error-the-property-cannot-be-found-on-this-object-verify-that-the-property-exists/" rel="nofollow noreferrer">https://learningintheopen.org/2020/05/07/powershell-error-the-property-cannot-be-found-on-this-object-verify-that-the-property-exists/</a></p>
  <p><a href="https://stackoverflow.com/questions/47979762/the-property-name-cannot-be-found-on-this-object-verify-that-the-property-exi">The property &#39;Name&#39; cannot be found on this object. Verify that the property exists</a></p>
  <p><a href="https://community.spiceworks.com/topic/391316-powershell-custom-object-not-settable" rel="nofollow noreferrer">https://community.spiceworks.com/topic/391316-powershell-custom-object-not-settable</a></p>
  <p>They seem to be the same error, but happening for slightly different reasons.</p>