Wait a minute. You want to assign the value of $namespace->GetSharedDefaultFolder($recipient, 6) to $p2? Then why did you put the assignment inside of an if statement?
Comment on Re: Re: Re: MS Outlook GetSharedDefaultFolder
Because $p2 = $namespace->GetSharedDefaultFolder($recipient,6) returns a lvalue, which the "if" operator interprets as true, if GetSharedDefaultFolder() succeeds. Otherwise it returns undef which "if" interprets as false.