67974-sourcecode.txt
- you can refer to the attached code.
- It work if I use this line
$srcUrl = "https://XXXXX.sharepoint.com/personal/xxxxxx_com"
3 But when I try to change above line into a looping condition, to look into a list of One Drive user's URLs like below code, then I will hit into error
$srcURLs=import-csv "C:\reports\list.csv"
write-host $srcURLs
Foreach($srcURL in $srcURLs)
{
write-host $srcURL
}
Error encountered
Authenticating ...
New-Object : Cannot find an overload for "ClientContext" and the argument count: "1".
At C:\reports\All item usage.ps1:196 char:15
- ... rcContext = New-Object Microsoft.SharePoint.Client.ClientContext($src ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [New-Object], MethodException
- FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'Credentials' cannot be found on this object. Verify that the property exists and can be set.
At C:\reports\All item usage_Manik_testCSV.ps1:198 char:1
- $srcContext.Credentials = $credentials
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At C:\reports\All item usage_Manik_testCSV.ps1:202 char:1
- $srcList = $srcWeb.Lists.GetByTitle($srcLibrary)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\reports\All item usage_Manik_testCSV.ps1:206 char:1
- $listItems = $srcList.GetItems($query)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\reports\All item usage.ps1:208 char:1
- $srcContext.Load($srcList)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\reports\All item usage_Manik.ps1:210 char:1
- $srcContext.Load($listItems)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\reports\All item usage_Manik.ps1:212 char:1
- $srcContext.ExecuteQuery()
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
Total Count:
Total Count: Completed: 0
END Start : '15-Feb-21,12:11:43'
PS C:\reports>