SPFile.CanOpenFile Method (Boolean, String)
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)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Function CanOpenFile ( _
checkCanGetFileSource As Boolean, _
<OutAttribute> ByRef eTag As String _
) As Boolean
'Usage
Dim instance As SPFile
Dim checkCanGetFileSource As Boolean
Dim eTag As String
Dim returnValue As Boolean
returnValue = instance.CanOpenFile(checkCanGetFileSource, _
eTag)
public bool CanOpenFile(
bool checkCanGetFileSource,
out string eTag
)
Parameters
checkCanGetFileSource
Type: System.Booleantrue to verify that the user can view the source for the file; otherwise, false.
eTag
Type: System.StringA 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.
Remarks
You can call this method before calling the OpenBinaryStream(SPOpenBinaryOptions, String, String) method.