Last modified: July 23, 2011
Applies to: Outlook
Establishes a view context for the form.
Most form servers implement SetViewContext by using the following algorithm:
If a view context already exists for the form, cancel the form's registration by calling the IMAPIViewContext::SetAdviseSink method with null in the pmnvs parameter, and then call the view context's IUnknown::Release method to decrement its reference count.
If the new view context is not null, call IMAPIViewContext::SetAdviseSink by using the pViewContext parameter to set up a new view advise sink.
If the new view context is not null, call the IMAPIViewContext::GetViewStatus method to determine which status flags have been set.
If the new view context is not null, store it and call its IUnknown::AddRef method to increment its reference count.
Update any user interface elements that depend on the view context.
Depending on the status flags returned from IMAPIViewContext::GetViewStatus, SetViewContext can also perform other actions. For example, if the VCSTATUS_NEXT and VCSTATUS_PREV flags are returned, SetViewContext can enable the Next and Previous buttons for the new view context.