When a customer logs into Navision each day they receive an email with that days tasks, if the user doesn’t have Outlook open on their pc then no-one else can then log into Navision until that user types their Outlook password, is there a way of writing some code so that if Outlook isn’t open, then exit that function and start up as normal without trying to send an email. The code I have currently is: CLEAR(OutlookApp); CREATE(OutlookApp); OutlookEmail := OutlookApp.CreateItem(0); OutlookEmail.“To” := ThisUserRec.“User Email”; Any help is much appreciated. -Mike
Mike, This is code from our Email Management codeunit; Globals; MAPIMessages OCX Microsoft MAPI Messages Control, version 6.0 MAPISession OCX Microsoft MAPI Session Control, version 6.0 IF MAPISession.SessionID = 0 THEN MAPISession.SignOn; MAPIMessages.SessionID := MAPISession.SessionID; Now I’d assume that it’s the SessionID that you’ll want to test and possible bypass, so try; IF MAPISession.SessionID <> 0 THEN BEGIN CLEAR(OutlookApp); CREATE(OutlookApp); OutlookEmail := OutlookApp.CreateItem(0); OutlookEmail.“To” := ThisUserRec.“User Email”; END; I haven’t tested this code. Hopefully it’ll work!?!?!? Good Luck [:D]
Thanks Connull, but after further investigation I found that the problem was being caused by the User table being locked until Outlook had been opened, I got around this by using COMMIT before creating Outlook and it seems to have done the trick. - Mike