The proc_FetchDocForRead stored procedure is invoked to request the metadata information and content of a document.
PROCEDURE proc_FetchDocForRead( @DocSiteId uniqueidentifier, @DocWebId uniqueidentifier, @DocDirName nvarchar(256), @DocLeafName nvarchar(128), @DocFullUrl nvarchar(260), @LooksLikeAttachmentFile bit, @GetContent bit, @GetWebListForNormalization bit, @bGetContainingList bit, @bCheckout bit, @UserId int, @Version int, @ChunkSize int, @MaxLevel tinyint, @Level tinyint OUTPUT );
@DocSiteId: The Site Collection Identifier (section 18.104.22.168) of the site collection containing the requested document.
@DocDirName: The directory name of the requested document.
@DocLeafName: The leaf name of the requested document.
@DocFullUrl: This parameter is unused.
@LooksLikeAttachmentFile: Specifies whether the requested document appears to the WFE to be an attachment to a list item. If this flag is set to "1", proc_FetchDocForRead MUST determine whether the current user has sufficient permissions to retrieve the requested document as an attachment.
@GetContent: A bit flag specifying whether to return the content of the document or not. If this flag is set to "1", proc_FetchDocForRead MUST return the content of the requested document in the Document Information and Content Result Set (section 22.214.171.124.10) or the Document Version Information and Content Result Set (section 126.96.36.199.11).
@GetWebListForNormalization: A bit flag specifying whether to return the subsite of the site specified by @DocWebId. If this flag is set to "1", proc_FetchDocForRead MUST return a list of child sites in the Subsite List Result Set (section 188.8.131.52.1).
@bGetContainingList: Specifies whether to return the event receivers information about the list containing the requested document. If this flag is set to "1", proc_FetchDocForRead MUST return the Event Receivers Result Set (section 184.108.40.206.6).
@bCheckout: Specifies whether the current user is requesting to check out the document. If this flag is set to "1", and the @LooksLikeAttachmentFile parameter is set to "1", proc_FetchDocForRead MUST determine whether the current user has sufficient permissions to check out the requested document as an attachment.
@UserId: The User Identifier (section 220.127.116.11) for the current user requesting the information. This is used by proc_FetchDocForRead for permission checking.
@Version: Specifies the UI version number of the document that is being requested. A value of "-1" specifies the most recent version of the document.
@ChunkSize: Specifies the maximum size, in bytes, of the document content image to be returned in the Document Information and Content Result Set. If the document content image size is larger than @ChunkSize, a single zero byte is returned as the document content image, and the WFE can request the content of the document in a subsequent operation.
@MaxLevel: A Publishing Level Type (section 18.104.22.168) value that indicates the maximum publishing level of the document to be returned in @Level if multiple levels of the document are available and the current user is not the owner of the draft or does not have the document checked out.
@Level: The Publishing Level Type value of the requested version of the document visible to the current user, returned as an output parameter. This value MUST be returned as NULL if the document does not exist.
Return Values: The proc_FetchDocForRead stored procedure returns an integer return code that MUST be in the following table.
The document does not exist.
The proc_FetchDocForRead stored procedure returns a Publishing Level Type value in the parameters as described earlier. proc_FetchDocForRead MUST return multiple result sets. Some of the result sets MUST NOT be returned depending upon input parameters or calculations performed in proc_FetchDocForRead, and all result sets that are returned MUST be sent in the order defined as follows.