How to use Redemption and Mapi GetSharedDefaultFolder together in VB?

B

Bingo

' Outlook Object Code without Redemption
' To get access to a shared folder
Set oMapiRecipient = oNsp.CreateRecipien(sMailboxName)
oMapiRecipient.Resolve

Set oMapiInbox = oNsp.GetSharedDefaultFolder
(oMapiRecipient, 6) ' 6 olFolderInbox

'This triggers the security popup.
'Then I use Redemption to bypass this popup.

Set oRdpUtil = CreateObject("Redemption.MAPIUtils")
Set oRdpRecipient = oRdpUtil.CreateRecipient(MailboxName)
oRdpRecipient.Resolve

'No popup, great
'But I got an error at

Set oMapiInbox = oNsp.GetSharedDefaultFolder
(oRdpRecipient, 6) ' 6 olFolderInbox

The error message is:
Run-time error '-2147352573(80020003)':
The property does not exist. The field you want to modify
is not valid for this type of item.

Anything wrong here? Thanks.
 
D

Dmitry Streblechenko \(MVP\)

You don't need Redemption to call GetSharedDefaultFolder: as long as you
don't call Recipient.Resolve, GetSharedDefaultFolder still works, but there
is no prompt:

' Outlook Object Code without Redemption
' To get access to a shared folder
Set oMapiRecipient = oNsp.CreateRecipien(sMailboxName)

Set oMapiInbox = oNsp.GetSharedDefaultFolder(oMapiRecipient, 6) ' 6
olFolderInbox

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
B

Bingo

That solved my problem. Thanks.

Now I need to add a recipient to a mail item. I'm
getting the Recipients off the mail,

Set oMapiRecipients = oMapiMail.Recipients

This triggers the security popup. How to bypass this?
Thanks.


-----Original Message-----
You don't need Redemption to call
GetSharedDefaultFolder: as long as you
 
D

Dmitry Streblechenko \(MVP\)

In this case you do need Redemption:

set SafeMail = CreateObject("Redemption.SafeMailItem")
SafeMail.Item = oMapiMail
Set oSafeRecipients = SafeMail.Recipients

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top