Solved

View other user's calendar

Posted on 2006-10-31
6
1,222 Views
Last Modified: 2009-07-29
Hello,

Is there any way that I can programmatically access another user's calendar via VBA/VB?
Using outlook 2000 SR1 Corporate/Workgroup with an exchange server (dont know what version).

The only way I know how to do it currently is to create a new appointment and go to Attendee Availability.  I can see their calendar that way, so it is at least somewhat accessible to me.

I've tried using   .GetSharedDefaultFolder(vRecipient, olFolderCalendar)   and get an error "The operation failed."  The recipient does resolve without issue so I know that isn't it.

Is there another way to do this?

Matt
0
Comment
Question by:mvidas
  • 4
  • 2
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 17846792
Hi, Matt.

It's been awhile since I did anything in Outlook 2000 and although I still have the software it's not in an Exchange environment.  I'm not sure I'll be of much help.  That said, I need to ask a couple of questions to get a complete picture of the situation.  Has the other user delegated access to their mailbox to you or are you an Exchange admin?  When you create an appointment and go to attendee availability do you see the details of their appointments or just see the time blocked off?

Cheers!
0
 
LVL 35

Author Comment

by:mvidas
ID: 17846864
The other users haven't delegated any access to me, probably why the GetSharedDefaultFolder didn't work. I could get access to it, I'm more wondering for fun if I can get it programmatically.
I'm not even positive of it being exchange, I just assume so as its a big company.  
In the attendee availability it looks just blocked off, but I can right-click it to see the actual details (not in a new inspector window, just a small pop-up).  I could post an example screenshot tomorrow if it would help.
I'm having a lot of fun exploring the outlook model, though definitely finding it's limits somewhat annoying.  With all the harm that could be done with code and email, I can see the purpose for most of it
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17846948
If you aren't an Exchange admin and they haven't explicitly given you permission to their mailbox, then GetSharedDefaultFolder won't work.  I'm surprised you get that little pop-up showing their appointment details when you right-click on an area of blocked-off time.  In Outlook 2003 users with no admin rights and no explicit permissions can't do that.  They just see the time blocked off.  As I said before though it's been awhile since I tinkered with 2000, so it must behave differently and I just didn't remember.  There may be a way to query the free & busy information directly.  Let me see what I can find on that topic.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 17847135
Give this a shot.  I just tried it in Outlook 2003/Exchange 2003 and it worked okay.  Not sure about 2000.  The key to this is the FreeBusy method of the Recipient object.  It returns a string, one character for each interval of time asked for, showing if the user is busy.  I've set it here to an interval of one hour.  The method returns free/busy time for 30 days.  I don't see a way to change that.  You can ask for a simple list where 0 is free and any other value is not, or a detailed list (which is what I set this for) that shows the actual status during that interval of time.  

Function IsUserFree(strUser As String, datStart As Date, datTime As Date) As Boolean
    Dim olkAppointment As Outlook.AppointmentItem, _
        olkUser As Outlook.Recipient, _
        varStatus As Variant, _
        intStart As Integer
    intStart = Hour(datTime)
    Set olkAppointment = Application.CreateItem(olAppointmentItem)
    Set olkUser = olkAppointment.Recipients.Add(strUser)
    olkUser.Resolve
    varStatus = olkUser.FreeBusy(datStart, 60, True)
    If Mid(varStatus, intStart, 1) = "0" Then
        IsUserFree = True
    End If
    Set olkUser = Nothing
    Set olkAppointment = Nothing
End Function
 
Sub TestFB()
    Debug.Print IsUserFree("John.Doe@company.com", #11/2/2006#, #8:00:00 AM#)
End Sub
0
 
LVL 35

Author Comment

by:mvidas
ID: 17849177
Nice! I hadn't even seen the FreeBusy method, that should give me what I need!

After actually looking closer at my calendar, all it shows when I right-click is "tentative", "out of office", etc, which is returned by FreeBusy as well.  I guess I never really looked that closely at it :)

Thanks!! Enjoy your first 2k points this month
Matt
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17850348
You're welcome.  
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now