I have a function :
void MyClass:eleteFolders()
{
USES_CONVERSION;
try {
CComPtr<Outlook::MAPIFolder> rootFolder;
CComPtr<Outlook::MAPIFolder> subFolder;
CComPtr<Outlook::_Folders> rootFolders;
CComPtr<Outlook::_Folders> subFolders;
spNameSpace->get_Folders(&rootFolders);
CComVariant ItemRoot("RootFolderName");
rootFolders->Item(ItemRoot, &rootFolder);
rootFolder->get_Folders(&subFolders);
CComVariant ItemSub("SubFolderName");
subFolders->Item(ItemSub, &subFolder);
subFolder->Delete();
rootFolder->Delete();
} catch (...) { };
}
I call it in MyClass::OnDisconection and it does not work.
May be in OnDisconection I can't delete folder ?
void MyClass:eleteFolders()
{
USES_CONVERSION;
try {
CComPtr<Outlook::MAPIFolder> rootFolder;
CComPtr<Outlook::MAPIFolder> subFolder;
CComPtr<Outlook::_Folders> rootFolders;
CComPtr<Outlook::_Folders> subFolders;
spNameSpace->get_Folders(&rootFolders);
CComVariant ItemRoot("RootFolderName");
rootFolders->Item(ItemRoot, &rootFolder);
rootFolder->get_Folders(&subFolders);
CComVariant ItemSub("SubFolderName");
subFolders->Item(ItemSub, &subFolder);
subFolder->Delete();
rootFolder->Delete();
} catch (...) { };
}
I call it in MyClass::OnDisconection and it does not work.
May be in OnDisconection I can't delete folder ?