IOfflineFilesSetting::GetPolicy method

Retrieves a policy associated with a particular Offline Files setting.


HRESULT GetPolicy(
  VARIANT *pvarValue,
  DWORD   dwScope



If the policy supports one or more values, the returned VARIANT object contains those values. If the policy does not support values, the type of the returned VARIANT is VT_EMPTY.

The method initializes the VARIANT prior to storing the policy value in it.


Indicates which policy is to be retrieved. Must be one of the following.

Note  Note that not all settings have an associated policy and those that do might not support both per-machine and per-user policy.


The per-user policy is to be retrieved.


The per-machine policy is to be retrieved.

Return Value

S_OK if the policy is read successfully or an error value otherwise.

Returns HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) if the setting does not support the requested policy.

Returns HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) if the requested policy is not currently applied.


It is important to note that policy cannot be set through the Offline Files API. Policy can be set only through the Group Policy mechanism. The Offline Files API only supports querying policy values.


Windows version Windows Vista Windows Server 2008
Target Platform Windows
Header cscobj.h
DLL CscSvc.dll; CscObj.dll

See Also