18.104.22.168 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.
If a view definition message already exists with the same PidTagViewDescriptorName property ([MS-OXPROPS] section 2.1056) 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:
Send the RopSetColumns ROP ([MS-OXCROPS] section 22.214.171.124) with the following properties:
PidTagMessageClass, followed by
Send the RopFindRow ROP ([MS-OXCROPS] section 126.96.36.199), searching for a match on the PidTagMessageClass, PidTagViewDescriptorVersion, and PidTagViewDescriptorName properties, as specified in section 2.2.6.
Send the RopQueryRows ROP ([MS-OXCROPS] section 188.8.131.52) 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 184.108.40.206 by sending the RopCreateMessage ROP ([MS-OXCROPS] section 220.127.116.11) on the folder, and passing the Associated flag.
If the client found a matching row, it MUST send the RopOpenMessage ROP ([MS-OXCROPS] section 18.104.22.168) 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 22.214.171.124.
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:
Send the RopOpenStream ROP ([MS-OXCROPS] section 126.96.36.199) to open Stream object handles on the PidTagViewDescriptorBinary property (section 188.8.131.52) and the PidTagViewDescriptorStrings property (section 184.108.40.206).
Write the serialized settings by using the RopWriteStream ROP ([MS-OXCROPS] section 220.127.116.11).
Persist the stream back to the property by sending the RopRelease ROP ([MS-OXCROPS] section 18.104.22.168).
Persist changes to the message by sending the RopSaveChangesMessage ROP ([MS-OXCROPS] section 22.214.171.124).