Sharing options are greyed out when sharing from Microsoft Teams, SharePoint or OneDrive

Do you get an error message when trying to share a file from Microsoft Teams, SharePoint Online or OneDrive for business?
Usually the message "Anyone with the link is not allowed to share the file - Your organisation is preventing you from selecting this option" appears.
See the screenshot below:

Check that the SharePoint and OneDrive sharing permissions are configured properly if you get the error message "Anyone with the link - Your organisation is preventing you from selecting this option."
Navigate to https://admin.onedrive.com and then press Share in Policies.
Then choose to use the most user-friendly External share settings by putting the slides at the top.

Sharing a specific Microsoft Teams (SharePoint) site with external users
It may sound strange, but even after the slides at the top give most rights to external users, it is still necessary to set external rights to everyone on the specific team site.
Browseto the SharePoint administrator centre via: https://admin.microsoft.com
Press at the bottom of the page SharePoint

Under Sites, select the desired site, press Policies, and then select External Sharing.

Turn these rights on for everyone so users can open or share files without logging in.

Only then will it be possible to share files in public via Microsoft Teams.

Make sure you are aware of this change. Perhaps it is better to also make it clear to the other team members that everyone can and may share files with other outsiders.
Also read
Tutorial: Microsoft Teams technical governance - best practice
Tutorial: How to share files in Microsoft Teams?
How to share files in Microsoft Office 365 and Teams - 8 scenarios
How to add external guests in Microsoft Teams?
How to communicate with external users in Microsoft Teams - meetings