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.

File: Open File OM

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:

  1. The WFE builds a dynamic query that invokes the proc_FetchDocForHttpGet stored procedure.

  2. The BEDS returns a return code of 0, and returns the following result sets:

    • HTTP Document Metadata Result Set (section This returns the document metadata needed to further process the document.

    • Domain Group Cache Versions Result Set (section 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 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 Used to establish that the current user has permissions to open the file.

    • Document Content Stream Result Set (section 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 Under our assumptions, Auditing is not enabled on the site collection, so the SiteGlobalAuditMask column is NULL.

    • List Audit Mask Result Set (section, 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.

  3. The OM returns control to the calling program with the array of bytes for the document stream of the requested file.