SMS_STATUS

All SMS API functions return a value of type SMS_STATUS. The functions can return the following values:

SMS_ALREADY_CONNECTED
Your application has an existing connection to the site database. An application can have only one connection to a site database at one time.
SMS_COMMIT_FAILED
For SmsCommitFolder, the folder could not be committed to the site database.
SMS_CONNECT_FAILED
For SmsCommitFolder, the connection to the site database has been broken. The folder could not be committed to the database.
SMS_CONTAINER_NOT_POPULATED
For SmsGetNextFolder, the specified container is not populated.

An action was attempted on a container before the container was populated. The container must be populated before this action can be processed.

SMS_CONTAINER_POPULATED
For SmsPopulate and SmsSetFilter, the specified container is already populated.

An action was attempted on a container after the container was populated. The action must be taken before the container is populated.

SMS_DUPLICATE_FILTER
For SmsSetFilter, a filter of the specified type has already been set on the container.
SMS_DUPLICATE_FOLDER
For SmsLinkFolder, the specified folder is newly created and a folder with the same name already exists in the SMS database.
SMS_EMPTY
For SmsPopulate, the container was populated but returned no folders—no objects of the type specified were found in the site database.

For SmsSetFilter, the application did not call SmsAddToken to add tokens to the filter.

SMS_ERROR
An unexpected error occurred. Usually, this is a SQL Server error.

Note that an insufficient size for the tempdb on the SQL Server containing the site database can cause this error to occur.

To size the tempdb, you should allocate 2K per machine (that is, 2K for each inventoried object, including objects of all architectures such as Personal Computer, SMSEvent, UserGroups, and so on). The log device should be at least 20 percent of the size of the data device. For example, if you have 50,000 machines in your SMS database, you should allocate at least 100 MB total for the tempdb and at least 20 MB for the tempdb log.

SMS_FILTER_NO_MODIFY
For SmsCommitFilter, the application attempted to commit a persistent filter. Only transient filters can be committed.
SMS_FOLDER_ALREADY_DELETED
An action was attempted on a folder or persistent filter that has already been deleted.
SMS_FOLDER_LINKED
For SmsLinkFolder, the specified folder has already been linked to the parent.
SMS_FOLDER_NO_UPDATE
For SmsCommitFolder and SmsSetScalar, the folder is of a type that has read-only access.

In order to set a scalar or commit a folder, the parent folder or container of the scalar or folder must also have ACCESS_MODIFY or ACCESS_CREATE permissions.

SMS_FOLDER_NOT_MODIFIED
For SmsCommitFolder, your application attempted to commit a newly-created folder whose scalars have not been set sufficiently to be added to the site database. Additional scalars may need to be set within the specified folder.
SMS_INVALID_CONNECTION_HANDLE
For SmsSetFilter, the filter's connection handle does not match the container's connection handle.
SMS_INVALID_CONTAINER_ID
An unknown container type was specified. The SMS API engine could not locate a container of the specified type.
SMS_INVALID_DATASOURCE
The attempt to connect to the site database failed because the datasource type could not be registered. Or the SMS API engine could not access the database.
SMS_INVALID_FILTER_ID
For SmsRewind and SmsGetNextFilter, no filters of the specified filter type were found in the filter container.

For SmsCommitFilter, the filter type is not valid. Currently, only machine filters can be committed.

For SmsGetFilterByID, no filters of the specified filter type were found in the filter container.

SMS_INVALID_FILTER_TYPE
For SmsSetFilter, your application has attempted to set a filter that is incompatible with the specified container.
SMS_INVALID_FOLDER_ID
For SmsCommitFolder, your application has attempted to commit a folder with an invalid identifier.

For SmsDescribeFolder, the specified folder type tag is for an unknown folder type. If an F_GROUP folder is specified, this status code is returned. The set of attributes for an F_GROUP folder is dependent on the instance of the group itself within a specific machine folder—there is no generic set of attributes for all F_GROUP folders.

SMS_INVALID_FOLDER_TYPE
The specified folder type is not a valid subfolder type for the specified parent folder or container.
SMS_INVALID_HANDLE
An invalid handle was used to access an object.

For SmsDataSourceConnect, the database connection could not be made because of a memory allocation failure.

For SmsOpenFilterContainer, the attempt to open the filter container failed.

SMS_INVALID_PARAMETER
For SmsPopulate, asynchronous population was specified for a container type that does not support asynchronous population. (Note that job containers and package containers do not support asynchronous population.) Or an invalid window handle was specified in the hwnd member of the pNotify structure.

For SmsCommitFolder, one of the folder's scalars does not contain a valid value.

For SmsLinkFolder, the specified folder contains one or more scalars that have not been set properly.

SMS_MORE_DATA
For SmsEnumFolderTypes, the type pfTypes parameter is NULL (returns count of folder types to pctFolderTypes) or the specified type count is less than the actual number of folder types (returns the number of items allocated for the pfTypes array). The operation completed successfully but more data is available.

For SmsGetFolderCount, if SmsPopulate is used in asynchronous mode, the function is still retrieving folders from the site database, that is, not all folders have been retrieved yet.

For SmsGetNextScalar and SmsGetScalarByName, the dwLen member of the pScalarStruct structure was set to NULL. If dwLen is NULL, these functions will set the dwLen member to the size of the SCALAR_STRING or SCALAR_BINARY scalar value.

For SmsGetAllFilters, this status code can be caused by one of the following conditions:

For SmsGetFilterType, the pszTag parameter is NULL.

For SmsEnumContainers, the buffer specified by ppData is not big enough and the function returns the count of container types in the DWORD specified by pCount. Or either ppData or pCount was set to NULL and the count of container types was returned to the pCount.

For SmsEnumFilters, the buffer specified by paFI is not big enough and the function returns the count of container types in the DWORD specified by pCount. Or either paFI or pCount was set to NULL and the count of container types was returned to pCount.

For SmsEnumFolders, the buffer specified by ppData is not big enough, and the function returns the count of folder types in the DWORD specified by pCount. Or either ppData or pCount was set to NULL and the count of folder types was returned to the pCount.

For SmsEnumObjects, the entry value of pCtObjects is less than the number of objects known to the system. The function returns this value but does not copy any information to the pObjects array.

For SmsEnumObjectTypes, the entry value of pCtObjects is less than the number of first-class objects known to the system. The function returns this value but does not copy any information to the pObjects array.

SMS_NEW_FOLDER
For SmsGetFolderID, the specified folder has only been created by using the SmsCreateFolder function. No identifier value has been assigned to the folder yet. A folder is assigned an identifier after it is committed to the site database by using SmsCommitFolder.
SMS_NO_CREATE
For SmsCreateFolder, the specified folder type does not support creation. The folder type is read-only.

For SmsDupFolder, the specified parent handle is not valid for this type of folder.

SMS_NO_MORE_DATA
For SmsGetFolderCount, the folder type (fType) F_ANY is specified for a folder (hFolder) that cannot contain subfolders.

For SmsGetNextFolder, no folder was retrieved because the end of the folder list was reached.

For SmsGetNextScalar, no scalar was returned because the end of the scalar list was reached.

For SmsGetScalarByName, the specified folder does not contain any scalars.

For SmsGetNextFilter, no filter was retrieved because the end of the filter list was reached.

SMS_NOT_FOUND
For SmsGetFolderByID, the folder with the specified identifier was not found.

For SmsSetScalar and SmsGetScalarByName, the specified folder does not contain the specified scalar.

For SmsGetFilterByID, the filter with the specified identifier could not be found in the filter container.

For SmsEnumObjects, either the object type pointed to by pszObjectType or the predecessor objects pointed to by pPredecessors were not found.

SMS_NOT_READY
SmsPopulate was used to retrieve folders in asynchronous mode and an attempt was made to access folders in a container before some or all folders were retrieved from the site database.

For SmsGetFolderCount, the function has not retrieved any folders from the site database yet.

For SmsGetNextFolder, the SMS API engine has returned a "not ready" status while retrieving the next folder from the site database.

SMS_OK
The function completed its action successfully.
SMS_PARAMETER_ERROR
For SmsEnumFolderTypes, the specified type count pctFolderTypes is greater than the actual number of folder types.

For SmsSetScalar, a scalar of type SCALAR_TIME has an invalid time value specified.

For SmsGetFilterID, your application attempted to get the filter identifier for a transient filter. SmsGetFilterID applies only to persistent filters in a filter container; transient filters have no identifier.

For SmsAddToken, one or more of the parameters in the TOKEN structure is invalid, or the pointer to the TOKEN structure is NULL. If your application attempted to add a token to an inventory rules folder and the szTokenString member of the TOKEN structure also uses the retrieve keyword, the szTokenString member may contain a file name that specifies an incorrect location for the file. SmsAddToken will not add the token to the inventory rules folder and will return a status of SMS_PARAMETER_ERROR. If your application passes OP_AND for the opAndOr parameter for an attribute filter, group filter, site filter, or architecture filter, a status of SMS_PARAMETER_ERROR is also returned.

For SmsGetFilterType, the pfilterType parameter is NULL.

For SmsManipulateTokens, value set for dwFlags is an unrecognized value.

For SmsEnumObjects, the value of pszObjectType is NULL.

SMS_PARENT_ALREADY_COMMITTED
For SmsCreateFolder, your application attempted to create a subfolder for a parent folder that has already been committed. After a folder is committed, modification is not allowed. This means that the child folder cannot be added to a parent folder that has already been committed.
SMS_PARENT_NEEDS_COMMIT
For SmsCommitFolder, your application must also commit the parent folder of the specified folder in order to commit the specified folder to the site database.
SMS_PARENT_NOT_FOUND
For SmsLinkFolder, the handle to the parent folder or container that was used to create the current folder has already been closed and it is not possible to insert the child into it.

For SmsUnlinkFolder, the handle to the parent folder or container has already been closed and it is not possible to remove the child folder from it.

SMS_RANGE_ERROR
For SmsGetToken, the specified token index is outside of the range of tokens in the filter or inventory rules folder.

For SmsManipulateTokens, the specified token indexes are outside of the range of tokens in the filter or inventory rules folder. Or the operation specified by dwFlags cannot be performed on the specified range of tokens.

SMS_SCALAR_NO_UPDATE
For SmsSetScalar, the scalar is of a type that has read-only access.

In order to update a scalar, the parent folder or container must support the operation as well as the scalar to set and the folder to commit.

SMS_SCALAR_WRONG_TYPE
For SmsSetScalar, the scType field specified in the SCALAR structure does not match the actual type of the specified scalar.
SMS_SQL_ERROR
An error occurred while trying to access SQL Server.
SMS_UNSUPPORTED
For SmsManipulateTokens, the TOK_GROUP_NOT flag is specified for a folder.