SPFile.CanOpenFile method (Boolean, String)

SharePoint 2013

Indicates whether the current user has permission to view the content of the file, specifying a level of access and an output variable to receive an ETag.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public bool CanOpenFile(
	bool checkCanGetFileSource,
	out string eTag
)

Parameters

checkCanGetFileSource
Type: System.Boolean

true to verify that the user can view the source for the file; otherwise, false.

eTag
Type: System.String

A reference to a variable that receives a hash stamp that identifies the version of the file. If the user does not have permission to open the file, the variable receives a null value.

Return value

Type: System.Boolean
true if the current user has permission; otherwise, false.

You can call this method before calling the OpenBinaryStream(SPOpenBinaryOptions, String, String) method.

Show: