1

Is it possible to grant access to file for a user the moment he tries to access it?

Here's the condition:

  1. User1 and User2 works for the same company.
  2. User1 uploads a file to a document library that is used by multiple different companies.
  3. User2 tries to download the file that User1 uploaded.
  4. Check if User2 is working for the same company as the user who uploaded the file.
  5. 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.

Thanks,

1

You can't grant access on access, but you could do it on create.

One way would be to have an event receiver grant permissions when the document is created.

But the easiest would probably be to create a folder per company and give them access to that folder and not the list directly. They should then upload to that folder and everything will be in place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.