0
votes

I am trying to delete the profile using below code.It always marks the profile for deletion if it is currently being used.The profile does not actually disappear until every client with an active session has disconnected.

I have closed the outlook and communicator.its still not deleting profile.

So how to disconnect the all the active session related to profile immediately using MAPI coding?

 res := MAPIAdminProfiles(0, pProfAdmin);
    if res = S_OK then
      begin
        res := pProfAdmin.DeleteProfile(ProfileName, 0);
        if not (res = S_OK) then
          FailMmessage := 'Error in deleting Profile:'+ IntToStr(res);
      end
    else
      begin
        FailMmessage := 'Error in retrieving Admin Profile:'+ IntToStr(res);
      end;
1

1 Answers

1
votes

MAPI will delete the profile after the last reference to it is gone. Are there still any applications running (including yours) that use MAPI? Check with Process Explorer from SysInternals if any app still has olmapi32.dll or msmapi32.dll loaded.