Language

FileAccessException Class

Definition

Raised when the identity used was refused by the storage service.

Distinct from FileUrlExpiredException, which is terminal: a pre-authorized URL lapsed, and the SDK does not resolve those bytes another way even when a contentUrl and a Graph credential are both present. This exception means the Graph route was the one that failed, refused by the service after the request was made.

public class FileAccessException : Microsoft.Teams.Apps.Files.FileException
type FileAccessException = class
    inherit FileException
Public Class FileAccessException
Inherits FileException
Inheritance
FileAccessException

Constructors

Name Description
FileAccessException()

Initializes a new instance of the FileAccessException class. Status is left 0.

FileAccessException(Int32, Nullable<FileActor>, String)

Initializes a new instance of the FileAccessException class with the status Graph returned, the identity the fetch was attempted as, and whatever the service said.

FileAccessException(String, Exception)

Initializes a new instance of the FileAccessException class with a specified error message and inner exception. Status is left 0.

FileAccessException(String)

Initializes a new instance of the FileAccessException class with a specified error message. Status is left 0.

Properties

Name Description
Actor

The identity the fetch was attempted as, when one was selected. null when the failure preceded credential selection.

Details

What the storage service itself said, verbatim and truncated, when it said anything.

A 403 covers an unconsented scope, a file the identity was never granted, and a drive item that does not exist, which are indistinguishable on the wire: Graph answers all three with 403, because telling an unauthorized caller whether a resource exists would disclose it. That collapse is right for branching and wrong for diagnosis, so the original text is kept here rather than discarded.

Status

Lets callers branch without string-matching the message. 401 means the token itself was rejected; 403 means the identity lacks the grant, and the two have different remedies.

Applies to