469,270 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

VB.Net, App - MAPI.Session as "foreign" User?

11
Hello,

i'm trying to make an Application which can get every Calendar entry from a FOREIGN User in Outlook on a Exchange 2003 Server.

At the moment i can only get my own calender entries. But i need to get the Entries from another User.

Here's my actually code:

Expand|Select|Wrap|Line Numbers
  1. Dim osession As New MAPI.Session
  2. Dim vEmpty As Object = System.Reflection.Missing.Value
  3.  
  4. osession.Logon(vEmpty, vEmpty, False, False, vEmpty, vEmpty, vEmpty)
  5.  
  6. Dim ofolder As Object = osession.GetDefaultFolder(MAPI.CdoDefaultFolderTypes.CdoDefaultFolderCalendar)
  7. Dim oMessages = ofolder.Messages
  8. Dim oAppointment = oMessages.GetFirst
  9.  
  10. Do While Not oAppointment Is Nothing
  11.  
  12. MsgBox("Appointment: " & oAppointment.Subject & vbCrLf & _
  13. "Start Time: " & oAppointment.StartTime & vbCrLf & _
  14. "End Time: " & oAppointment.EndTime & vbCrLf & _
  15. "Location: " & oAppointment.Location & vbCrLf & _
  16. "Description: " & oAppointment.Text & vbCrLf)
  17. oAppointment = oMessages.GetNext
  18.  
  19.  Loop
  20.  
Is there any way to do this?

Thank you!

Chris

P.s
Sorry for my bad english.
Nov 13 '08 #1
1 1937
chrisli
11
Solved it :)

Here you go :)
Expand|Select|Wrap|Line Numbers
  1. Public Sub ReadOtherUserAppointment()
  2.         Dim objolApp As New Outlook.Application
  3.         Dim objNS As Outlook.NameSpace
  4.         Dim objRecip As Outlook.Recipient
  5.         Dim objFolder As Outlook.MAPIFolder
  6.         Dim UserName As String = "m.mustermann" 
  7.  
  8.         objNS = objolApp.GetNamespace("MAPI")
  9.         objRecip = objNS.CreateRecipient(UserName)
  10.         objRecip.Resolve()
  11.  
  12.         If objRecip.Resolved Then
  13.  
  14.             objFolder = objNS.GetSharedDefaultFolder(objRecip, Outlook.OlDefaultFolders.olFolderCalendar)
  15.  
  16.             For i As Integer = 1 To objFolder.Items.Count
  17.                 'For example...
  18.                 MsgBox(objFolder.Items.Item(i).Subject)
  19.                 MsgBox(objFolder.Items.Item(i).Start)
  20.             Next
  21.  
  22.         End If
  23.     End Sub
  24.  
The User has to Share his Calender with you.

Greetings
Nov 13 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by EricRobineau | last post: by
2 posts views Thread by mirandacascade | last post: by
3 posts views Thread by kang jia | last post: by
14 posts views Thread by Rick | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.