>#DEFINE olFolderInbox 6
>
>When another user gives you NO access to his mailbox and I try to go to his mailbox, how can I intercept the error i get (OLE IDispatch exception code 4096 from Microsoft Outlook). I use the following code:
>
>oOutlook = CREATEOBJECT("Outlook.Application")
>oNameSpace = oOutlook.GetNameSpace("MAPI")
>
>oUser = oNameSpace.CreateRecipient("MICHAEL")
>
>oInbox = oNameSpace.GetSharedDefaultFolder(oUser,olFolderInbox)
>
>FOR EACH oInbox IN oInbox.Items && The error occurs here
And the problem is there - you're creating an instance variable oInBox that's overwriting the source object (which you've named oInBox). Try something like:
FOR EACH oInBoxItem IN oInBox.Items
and within the loop, reference the instance variable oInBoxItem. Don't hurt yourself needlessly...VFP will do exactly what you want it to, with all the bad consequences imaginable.
>
>endfor
>
>Thanks in advance