QBFC iqbauthpreferences reference

The QBSessionManager has a QBAuthPreferences property that returns the IQBAuthPreferences object that you can set to indicate the level of QB access that your application requires and the QB editions that your application supports. The following table shows the properties you can use.

Functionality Property Notes
Specify which QuickBooks editions your application supports. PutAuthFlags By default, QB Pro, Premier, and Enterprise are supported. If you want your application to support a subset of these, or support QB Simple Start edition, you need to set this property accordingly.
Is your application read-only, or does it also write to QB? GetIsReadOnly PutIsReadOnly  
Does your application need to run in unattended mode? GetUnattendedModePref PutUnattendedModePref  
Does your application need access to personal data in QB? GetPersonalDataPref PutPersonalDataPref  
Is the IQBAuthPreferences object and properties supported by the QuickBooks currently running? WasAuthPreferencesObeyed  
IQBAuthPreferences.GetIsReadOnly
HRESULT GetIsReadOnly(VARIANT_BOOL *pIsReadOnly)

Returns the application’s read-only access requirements from the IQBAuthPreferences object.

Parameters

**pIsReadOnly Pointer to the returned read-only preferences.

IQBAuthPreferences.GetPersonalDataPref
HRESULT GetPersonalDataPref(ENPersonalDataPrefType *pPersonalDataPref)

Returns the application’s personal data access requirements from the IQBAuthPreferences object.

Parameters

pPersonalDataPrefPointer to the returned preferences setting. Returns pdptRequired, pdptOptional, or pdptNotNeeded.

IQBAuthPreferences.GetUnattendedModePref
HRESULT GetUnattendedModePref(ENUnattendedModePrefType
*pUnattendedModePref)

Returns the application’s unattended mode requirements from the IQBAuthPreferences object.

Parameters

*pUnattendedModePrefPointer to the returned setting, which will be either umptRequired or umptOptional.

IQBAuthPreferences.PutAuthFlags
HRESULT PutAuthFlags([in] long authFlags);

For a description on how to use this and how to construct authFlags, see Chapter 5, “Accessing Desktop QuickBooks Editions.”

IQBAuthPreferences.PutIsReadOnly
HRESULT PutIsReadOnly(VARIANT_BOOL isReadOnly)

Invoked on the IQBAuthPreferences object to specify whether your application needs read- only access to the company file.

Parameters

isReadOnly Specify True if your application accesses QuickBooks only in read mode. Specify False if your application needs to write data to QuickBooks.

If your application specifies True, then the user must authorize read-only access (and whatever other preferences are currently specified in the IQBAuthPreferences object). If your application subsequently attempts to write data to QuickBooks, it will not be allowed to write and an error will be returned in the responses that attempts to write data.

IQBAuthPreferences.PutPersonalDataPref
HRESULT PutPersonalDataPref(ENPersonalDataPrefType personalDataPref)

Invoked on the QBAuthPreferences object to specify your application’s requirements regarding access to personal data in the company file.

Parameters

personalDataPref

Specify pdptRequired, pdptOptional, or pdptNotNeeded.

A value of pdptRequired means that your application will not run unless the administrative user grants access to personal data. A value of pdptOptional means that the application may use personal data, but can still run if the user does not grant it that access.

A value of pdptNotNeeded means that your application does not use personal data and the user will not have the opportunity to grant it that access. If your application attempts to access personal data, any personal data will be automatically filtered out and will not appear in the responses to requests.

IQBAuthPreferences.PutUnattendedModePref
HRESULT PutUnattendedModePref(ENUnattendedModePrefType UnattendedModePref)

Invoked on the QBAuthPreferences object to specify whether your application needs unattended mode (auto-login) access to the company file.

Parameters

UnattendedModePref

Specify umptRequired or umptOptional. Specify umptRequired if your application must be able to run in unattended mode or umptOptional if such access is not required.

IQBAuthPreferences.WasAuthPreferencesObeyed
HRESULT WasAuthPreferencesObeyed(VARIANT_BOOL *pWasAuthPreferencesObeyed)

Returns verification whether the current version of QuickBooks supports the IQBAuthPreferences object property and methods.

Parameters

pWasAuthPreferencesObeyedPointer to the returned value. True means there is support for IQBAuthPreferences, False means there is no support.

This method is useful for determining whether the QuickBooks currently being accessed is capable of supporting the authorization preferences feature.