Monday, May 11, 2015

Strangest error using power shell to connect to SharePoint online

My simple power shell script which I used to create large lists stopped working, reporting the following strange error: "The Application ID (AppID) for which the service ticket is requested does not exist on the system." After struggling with what appears to be a mess of people reporting it on different forums and blogs, even offering vudu solutions on how working from home would cause this issue, and running to the office might resolve it - I almost gave up. Until I noticed my login user name had a typo in it. Correcting it resolved the issue - so I guess this error message is actually a login user name / password are wrong... The error comes as soon as you try to create client context or pull any information. Not saying there couldn't be any other causes for this issue, just be sure to triple check you provided the correct login information... my code: $User = "user@domain.com" $SiteURL = "https://sometenant.sharepoint.com" $Password = Read-Host -Prompt "Please enter your password" -AsSecureString $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password) $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password) $Context.Credentials = $Creds ... Good luck!