locked
You cannot call a method on a null-valued expression. RRS feed

  • Question

  • Can someone please help me fix the error below. 

     

    You cannot call a method on a null-valued expression.
    At C:\SHAREGATE\CreateFoldersInODFB.ps1:88 char:2
    +     $newFolder = $spoFolder.Folders.Add($Folder1)
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

    Cannot find an overload for "Load" and the argument count: "1".
    At C:\SHAREGATE\CreateFoldersInODFB.ps1:89 char:2
    +     $web.Context.Load($newFolder)
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodException
        + FullyQualifiedErrorId : MethodCountCouldNotFindBest

    Here is the code

    The full script can be found here

    https://gallery.technet.microsoft.com/office/This-script-will-create-941c58af#content

    Thanks in advanced. 

    Wednesday, September 4, 2019 3:52 AM

All replies