12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples
MIT License
1.28k stars 567 forks source link

Error with SPOData.WebUrl.Substring - Lengt cannot be less than zero #34

Closed ondraandy closed 3 years ago

ondraandy commented 3 years ago

Hello, can you help me please with this error? I don´t know how can I fix it. Thanks!! Screenshot 2021-07-23 120223

12Knocksinna commented 3 years ago

Looks like the call to populate the $SPOData variable didn't work. Do you have all the required Graph permissions consented for the program?

$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/drive" $SPOData = Get-GraphData -AccessToken $Token -Uri $uri

Alternatively, if you're running this script against a tenant which doesn't use English language values for the document libraries in the SPO sites, you need to adjust these variables at the start of the script:

$SharedDocFolder = "/Shared%20Documents" # These values are to allow internationalization of the SPO document library URL. For French, this would be "/Documents%20partages" $SharedDocFolder2 = "/Shared Documents" # Add both values

stefanopagliuca commented 3 years ago

Hi, did you solved the issue? I have the same problem with the script. PErmission in MS Graph seems to be fine. Thanks,