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 |
HRESULT GetIsReadOnly(VARIANT_BOOL *pIsReadOnly)
Returns the application’s read-only access requirements from the IQBAuthPreferences object.
**pIsReadOnly
Pointer to the returned read-only preferences.
HRESULT GetPersonalDataPref(ENPersonalDataPrefType *pPersonalDataPref)
Returns the application’s personal data access requirements from the IQBAuthPreferences object.
pPersonalDataPref
Pointer to the returned preferences setting. Returns pdptRequired, pdptOptional, or pdptNotNeeded.
HRESULT GetUnattendedModePref(ENUnattendedModePrefType
*pUnattendedModePref)
Returns the application’s unattended mode requirements from the IQBAuthPreferences object.
*pUnattendedModePref
Pointer to the returned setting, which will be either umptRequired or umptOptional.
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.”
HRESULT PutIsReadOnly(VARIANT_BOOL isReadOnly)
Invoked on the IQBAuthPreferences object to specify whether your application needs read- only access to the company file.
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.
HRESULT PutPersonalDataPref(ENPersonalDataPrefType personalDataPref)
Invoked on the QBAuthPreferences object to specify your application’s requirements regarding access to personal data in the company file.
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.
HRESULT PutUnattendedModePref(ENUnattendedModePrefType UnattendedModePref)
Invoked on the QBAuthPreferences object to specify whether your application needs unattended mode (auto-login) access to the company file.
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.
HRESULT WasAuthPreferencesObeyed(VARIANT_BOOL *pWasAuthPreferencesObeyed)
Returns verification whether the current version of QuickBooks supports the IQBAuthPreferences object property and methods.
pWasAuthPreferencesObeyed
Pointer 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.