Deleting a Public Folder from Favorites

You can delete one or more public folders from a user’s Favorites folder by calling the IExchangeFavorites::DelFavorites method. Before you call it, you must prepare an ENTRYLIST structure to list the public folders to be deleted. For more information about ENTRYLIST structures, see the MAPI Programmer’s Reference.

    To delete one or more public folders from a user’s Favorites folder
  1. Open the public information store by calling the HrOpenExchangePublicStore function. This function call returns an lpMDB pointer to the open store, which also gives you access to the MAPI IMsgStore interface.
  2. Use the IMAPIProp::GetProps method to read the PR_IPM_FAVORITES_ENTRYID property, which contains the entry identifier of the Favorites folder.
  3. Open the Favorites folder within the information store by calling the MAPI IMsgStore::OpenEntry method. In this function call, pass the entry identifier of the folder in the lpEntryID parameter. This call returns a pointer to the IExchangeFavorites interface.
  4. Call the HrMAPICreateEntryList function to create an entry list of folders to delete.
  5. Call the IExchangeFavorites::DelFavorites method, which deletes one or more public folders as specified in the ENTRYLIST structure.