File Permissions API for DotNET

Hi, I’m having trouble applying the file permissions api on DotNET. I’m trying to change access to a file I saved so that I can grant access to a specific user using this:

Backendless.InitApp(“application-Id”, “API-key”);
FilePermission.Read.GrantForUser(“userId”, “mission/fox4.txt”);

Problem is that “GrantForUser” seems to have an issue, gives me an issue code of CS0120: an object reference is required.

Can anyone help me as to why ““GrantForUser” is not being recognized?

Thanks

Hello @Lerwin_Tan1

Welcome to our community and thank you for trying out Backendless.

You’re absolutely right to refer to the documentation — however, after checking the actual source code of FilePermission, we can confirm that:

  • READ is not static — it’s an instance field.
  • That’s why you get the CS0120 error: you’re trying to access a non-static member in a static way.

Correct usage would be:

var permission = new FilePermission();
permission.READ.GrantForUser(userId, "mission/fox4.txt");

It looks like the SDK documentation is outdated or incorrect in this case. Thanks for spotting that!

Regards,
Volodymyr

Hello, thanks for the clarification, I applied the lines you’ve given but there’s another error being replied, it says:

Cannot invoke “com.backendless.services.file.permissions.FileOperation.getId()” because the return value of “com.backendless.services.file.permissions.FileUserPermission.getOperation()” is null

Hello @Lerwin_Tan1

Thank you for reporting the issue.

We’ve identified the problem in the .NET SDK and have implemented the necessary fix on our side. We’ll notify you as soon as the updated API becomes available for use.

We appreciate your patience and thank you for bringing this to our attention!

Best regards,
Viktor

Thanks