Is it possible to grant access to file for a user the moment he tries to access it?
Here's the condition:
- User1 and User2 works for the same company.
- User1 uploads a file to a document library that is used by multiple different companies.
- User2 tries to download the file that User1 uploaded.
- Check if User2 is working for the same company as the user who uploaded the file.
- If yes, grant access.
The reason why I want to do this is because the document library is being used by different companies. The requirement is only users under the same company can access a file uploaded by that company.