3.2.5.2.2.15 INtmsMediaServices1::AddNtmsMediaType (Opnum 18)

The AddNtmsMediaType method MUST add a media type to a library if there is not currently a relation in the library. The method MUST create the system media pools (FREE, IMPORT, and UNRECOGNIZED) if they do not exist.

 HRESULT AddNtmsMediaType(
   [in] LPNTMS_GUID lpMediaTypeId,
   [in] LPNTMS_GUID lpLibId
 );

lpMediaTypeId: A pointer to the identifier of a media type to add to the library.

lpLibId:  A pointer to the identifier of the library to which the media type is to be added.

Return value/code

Description

0x00000000

S_OK

The call was successful.

0x80070005

ERROR_ACCESS_DENIED

NTMS_MODIFY_ACCESS to the library is denied; other security errors are possible, but indicate a security subsystem error.

0x80070008

ERROR_NOT_ENOUGH_MEMORY

An allocation failure occurred during processing.

0x80070057

ERROR_INVALID_PARAMETER

The media type or library identifiers are missing.

0x800710CD

ERROR_INVALID_LIBRARY

The library identifier is invalid.

0x800710D9

ERROR_DATABASE_FAILURE

The database is inaccessible or damaged.

0x800710DA

ERROR_DATABASE_FULL

The database is full.

If the specified media type is not in the library object's list of already supported media types, the AddNtmsMediaType method adds the it to the specified library. If the specified media type is already in the library object's list of already supported media types, the AddNtmsMediaType method will not add the it to the specified library also it will not return error because of this. AddNtmsMediaType then creates the system media pools if they do not exist.

If the specified media type is not in the library object's list of already supported media types, the AddNtmsMediaType method adds it to the specified library. If the specified media type is already in the library object's list of supported media types, the specified media type is not added to the library object's list. In both instances, AddNtmsMediaType creates the system media pools if they do not exist.

Upon receiving this message, the server MUST verify that lpLibId and lpMediaTypeId are not NULL. If parameter validation fails, the server MUST immediately fail the operation and return ERROR_INVALID_PARAMETER (0x80070057).

If parameter validation succeeds, the server MUST verify that the user has the required access rights and that the library is enabled and online. If the library is offline, the server MUST return ERROR_LIBRARY_OFFLINE (0x800710D1).