Partager via


IMAPIProp::DeleteProps

Applies to: Office 2010 | Outlook 2010 | Visual Studio

In this article
Notes to Implementers
Notes to Callers
MFCMAPI Reference

Deletes one or more properties from an object.

HRESULT DeleteProps(
  LPSPropTagArray lpPropTagArray,
  LPSPropProblemArray FAR * lppProblems
);

Parameters

  • lpPropTagArray
    [in] A pointer to an array of property tags that indicate the properties to delete. The cValues member of the SPropTagArray structure pointed to by lpPropTagArray must not be zero, and the lpPropTagArray parameter itself must not be NULL.

  • lppProblems
    [in, out] On input, a pointer to a pointer to an SPropProblemArray structure; otherwise, NULL, which indicates that there is no need for error information. If lppProblems is a valid pointer on input, DeleteProps returns detailed information about errors in deleting one or more properties.

Return Value

  • S_OK
    Properties were successfully deleted.

  • MAPI_E_NO_ACCESS
    The caller has insufficient permissions to delete properties.

Remarks

The IMAPIProp::DeleteProps method removes one or more properties from the current object.

Notes to Implementers

You do not have to allow properties to be deleted from all objects. If the object is not modifiable, return MAPI_E_NO_ACCESS from the DeleteProps method.

Notes to Callers

You do not have to set the property type for each property tag in the property tag array pointed to by the lpPropTagArray parameter. Property types are ignored; only the property identifiers are used.

Be aware that some objects do not allow modification and that these objects return MAPI_E_NO_ACCESS from the DeleteProps method. Other objects allow some properties to be deleted, but not others. When there is a problem deleting only some of the properties, DeleteProps returns S_OK. If you have passed a valid pointer in the lppProblems parameter, DeleteProps will set the pointer to an SPropProblemArray structure that contains detailed information about the problems with each property. For example, if you are deleting all of the properties of a message and there is a problem with one or more of its attachments, the SPropProblemArray structure will contain an entry for the PR_MESSAGE_ATTACHMENTS (PidTagMessageAttachments) property.

The structure pointed to by lppProblems is only valid if DeleteProps returns S_OK. If DeleteProps returns an error, do not attempt to use the SPropProblemArray structure. Instead, call the object's IMAPIProp::GetLastError method to obtain more information about the error.

Free the returned SPropProblemArray structure by calling the MAPIFreeBuffer function.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MAPIFunctions.cpp

DeleteProperty

MFCMAPI uses the IMAPIProp::DeleteProps method to delete a property from an object.

See Also

Reference

IMAPIProp::GetLastError

IMAPIProp::GetProps

IMAPIProp::SaveChanges

MAPIFreeBuffer

SPropProblemArray

SPropTagArray

IMAPIProp : IUnknown

Concepts

MFCMAPI as a Code Sample