4.2 File: Open File OM
This example describes the requests and responses made when the WFE opens an existing file stored as a document in a document library on the BEDS with a SharePoint Object Model call.
Figure 2: File: Open File OM
This scenario is initiated by a call to the Microsoft.SharePoint.SPFile.OpenBinary() object model command. For simplicity's sake, this example assumes that the file is stored as a document in a document library, and that the requested version is a draft created by the same user who is opening the file. This example assumes that:
The code has already instantiated the site collection (SPSite), Site (SPWeb), and document library (SPList) objects containing the document to be opened.
Auditing is disabled for the site collection.
The current user has File Open permissions for the document.
Site groups in the site collection do not include any domain groups as members.
The following actions happen:
The WFE builds a dynamic query that invokes the proc_FetchDocForHttpGet stored procedure.
The BEDS returns a return code of 0, and returns the following result sets:
HTTP Document Metadata Result Set (section 188.8.131.52.1). This returns the document metadata needed to further process the document.
Domain Group Cache Versions Result Set (section 184.108.40.206). The versions of the Domain Group cache on BEDS and WFE, used to determine if either the BEDS or WFE has more up-to-date information about external group membership in Roles, which are stored as site groups.
Domain Group Cache WFE Update Result Set (section 220.127.116.11). Used to update the WFE's external group map cache if needed. Under our assumptions, this result set is empty, since no domain groups are members of any roles in the site collection.
User Information Result Set (section 18.104.22.168.5). Used to establish that the current user has permissions to open the file.
Document Content Stream Result Set (section 22.214.171.124.8). Includes the document stream containing the binary file content for the current version of the document visible to the user, along with additional document metadata.
Site Audit Mask Result Set (section 126.96.36.199). Under our assumptions, Auditing is not enabled on the site collection, so the SiteGlobalAuditMask column is NULL.
List Audit Mask Result Set (section 188.8.131.52.10), containing auditing information for the document's containing document library. Under our assumptions, auditing is not enabled for the site collection, so the fields containing audit masks are NULL.
A Dynamic Query Result Set containing a single row with a single unnamed column, holding the value of the @Level output parameter from the stored procedure proc_FetchDocForHttpGet. The value is 2, indicating that the content returned is from the latest draft version.
The OM returns control to the calling program with the array of bytes for the document stream of the requested file.