KB Article #181285

SHAREPOINT: Error "401 Unauthorized" when using SharePoint Online

Problem

In some rare occasions a SharePoint Transfer Site can receive an error 401 Unauthorized, even though all of the prerequisites are met. An error similar to the below one might be observed on SharePoint's side:


Exception occured in scope Microsoft.SharePoint.SPFileCollection.Add. Exception=Microsoft.SharePoint.Client.ClientServiceException: The HTTP method 'GET' cannot be used to access the resource 'Add'. The operation type of the resource is specified as 'Default'. Please use correct HTTP method to invoke the resource. 
at Microsoft.SharePoint.Client.ServerStub.CheckBlockedMethod(String methodName, ProxyContext proxyContext) 
at Microsoft.SharePoint.ServerStub.SPFileCollectionServerStub.InvokeMethod(Object target, String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid) 
at Microsoft.SharePoint.Client.ServerStub.InvokeMethodWithMonitoredScope(Object target, String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid)


On ST's side the following will be logged in the File Tracking details:


Failure Details: Error during transfer operation: Error during upload operation : Error during upload operation: User not authorized. Session invalid. Status code is: 401


Resolution

In some rare occasions the token generation in SharePoint Online fails if the URL in the SharePoint Transfer Site includes the port number.



A SharePoint Transfer Site with the port in the URL


To resolve the issue remove the port number from the Specify partner using URL Address field in the Transfer Site.



A SharePoint Transfer Site without the port in the URL