MAC SharePoint users were downloading the files from SharePoint 2007 Document Libraries using the CURL command but the same is not working after migrating the SharePoint 2007 sites to SharePoint Online(SPOL).
SharePoint Online uses claims based authentication and direct NTLM based curl commands are not allowed.
SPOL allows remote applications to call the REST API with user impersonation. This article demonstrates how to access SPOL REST API and download the files from a tenant using Apple Bash Script and Curl commands. However, outside of .NET the authentication piece is not so straightforward. App authentication solves this issue for registered apps but in this document you will see how remote user authentication can be achieved, regardless of platform.
The below diagram illustrates the HTTP requests which need to be made in order to authenticate SharePoint Online.
Office 365 Tenant connected with Active Directory Federated Service(ADFS) and MAC OS
- Download the here file from
- Open file in a text editor(TextWrangler/TextMate) and update the UserName (Line #4) and Password (Line #5).
Note: The UserName & Password provided should have access to download the file from SharePoint Online.
- To download the file from a different SharePoint Online site/library/folder/file where the account has access, change the values of EndPoint(Line #6) and FileServerRelativeUrl(Line #7) values.
- Save the file
- Open Terminal (command line tool) and go to the path where file is saved
- Execute the following command to convert the file executable chmod 700
- Run the script using just the name of the script(Example : ./ )
- If all goes well, you should be able to see the downloaded file in the output path given in OutputFilePath(Line #9).
- UserName and Password provided might be wrong
- Access denied from SharePoint Online for the UserName and Password provided
- Provided Site/Document Library/Folder/File is not available in SharePoint Online or wrong
- Text Editor might have changed or corrupted the file while saving