3.1.4.4 Writing View Definitions

To write settings in a view definition, as specified in section 2.2.6, the client MUST open the folder that contains the view definition message. The client MUST save the view definition message in the folder that will display that view.

The client MUST call the RopGetContentsTable ROP ([MS-OXCROPS] section 2.2.4.14) with the Associated flag to open the FAI contents table, as specified in [MS-OXCFOLD] section 2.2.1.14.

If a view definition message already exists with the same PidTagViewDescriptorName property ([MS-OXPROPS] section 2.1046) in the same folder, the client MUST open that message and save the view definition there. The client MUST search for a matching row in the FAI contents table by using steps equivalent to the following, as specified in [MS-OXCTABL] section 2.2.2:

  1. Send the RopSetColumns ROP ([MS-OXCROPS] section 2.2.5.1) with the following properties:

    • PidTagFolderId ([MS-OXCFOLD] section 2.2.2.2.1.6)

    • PidTagMid ([MS-OXPROPS] section 2.792)

    • PidTagMessageClass ([MS-OXCMSG] section 2.2.1.3)

    • PidTagViewDescriptorVersion ([MS-OXPROPS] section 2.1048)

    • PidTagViewDescriptorName ([MS-OXPROPS] section 2.1046)

  2. Send the RopSortTable ROP ([MS-OXCROPS] section 2.2.5.2) with a sort order that includes the following properties:

    • PidTagMessageClass, followed by

    • PidTagViewDescriptorVersion

    • PidTagViewDescriptorName

  3. Send the RopFindRow ROP ([MS-OXCROPS] section 2.2.5.13), searching for a match on the PidTagMessageClass, PidTagViewDescriptorVersion, and PidTagViewDescriptorName properties, as specified in section 2.2.6.

  4. Send the RopQueryRows ROP ([MS-OXCROPS] section 2.2.5.4) to retrieve a single row and get the PidTagFolderId and PidTagMid properties of the matching message from the row.

If the message does not exist, the client MUST create the message as specified in [MS-OXCMSG] section 2.2.3.2 by sending the RopCreateMessage ROP ([MS-OXCROPS] section 2.2.6.2) on the folder, and passing the Associated flag.

If the client found a matching row, it MUST send the RopOpenMessage ROP ([MS-OXCROPS] section 2.2.6.1) to open the message, using the PidTagFolderId and PidTagMid properties from the table row and setting the ReadWrite flag in the OpenModeFlags field, as specified in [MS-OXCMSG] section 2.2.3.1.

If the client found a matching message or created a new one, it MUST save the serialized settings streams on the properties specified in section 2.2.6 by using steps equivalent to the following, as specified in [MS-OXCPRPT] section 2.2.16:

  1. Send the RopOpenStream ROP ([MS-OXCROPS] section 2.2.9.1) to open Stream object handles on the PidTagViewDescriptorBinary property (section 2.2.6.1) and the PidTagViewDescriptorStrings property (section 2.2.6.2).

  2. Write the serialized settings by using the RopWriteStream ROP ([MS-OXCROPS] section 2.2.9.3).

  3. Persist the stream back to the property by sending the RopRelease ROP ([MS-OXCROPS] section 2.2.15.3).

  4. Persist changes to the message by sending the RopSaveChangesMessage ROP ([MS-OXCROPS] section 2.2.6.3).

Show: