GetSharedDefaultFolder() throws error MAPI_E_NOT_FOUND - redemption

1.4k views Asked by At

I am using redemption in my windows application. There I have written this code

try
{
     rFolder = rSession.GetSharedDefaultFolder(memberName, rdoDefaultFolders.olFolderCalendar);
     rItems = rFolder.Items;
}

But when it executing the line which includes Session.GetSharedDefaultFolder(), it throws following exception.

"Error in IAddrBook.ResolveName: MAPI_E_NOT_FOUND"

I searched online for this issue, but I was not able to get something straight forward. Please advice me.

2

There are 2 answers

0
Dmitry Streblechenko On BEST ANSWER

What do you pass to GetSharedDefaultFolder? Can that name be resolved in Outlook in the To edit box in Outlook?

Keep in mind that GetSharedDefaultFolder takes either a string or an RDOAddressEntry object. In the latter case there is nothing to resolve, so if you already have an instance of the RDOAddressEntry object, it might be more reliable to pass it instead of a string.

0
Eugene Astafiev On

Why do you need to use Redemption?

Instead, I'd suggest using the GetSharedDefaultFolder method of the Namespace class instead. It returns a Folder object that represents the specified default folder for the specified user.

 Sub ResolveName() 
  Dim myNamespace As Outlook.NameSpace 
  Dim myRecipient As Outlook.Recipient 
  Dim CalendarFolder As Outlook.Folder 
  Set myNamespace = Application.GetNamespace("MAPI") 
  Set myRecipient = myNamespace.CreateRecipient("Eugene Astafiev") 
  myRecipient.Resolve 
  If myRecipient.Resolved Then 
   Call ShowCalendar(myNamespace, myRecipient) 
  End If 
 End Sub 

 Sub ShowCalendar(myNamespace, myRecipient) 
  Dim CalendarFolder As Outlook.Folder 
  Set CalendarFolder = _ 
  myNamespace.GetSharedDefaultFolder _ 
  (myRecipient, olFolderCalendar) 
  CalendarFolder.Display 
 End Sub

Be aware, you need to pass an instance of the Recipient class (resolved) to the method, not just a member name.

Do you get any error when running the code listed above (of course, with a valid name)?