ExchangeUser.GetFreeBusy メソッド (Outlook)

文字列 を表す ExchangeUser の 30 日間の期間の開始日から指定された日付の午前 0 時に開始を取得します。

構文

expression. GetFreeBusy( _Start_ , _MinPerChar_ , _CompleteFormat_ )

ExchangeUser オブジェクトを表す変数。

パラメーター

名前 必須 / オプション データ型 説明
Start 必須 日付 空き時間情報の取得開始日 (午前 0 時から開始)。
MinPerChar 必須 長整数型 (Long) タイム スロットの長さを分単位で指定します。 既定値は 30 分です。
CompleteFormat 省略可能 バリアント型 (Variant) True の場合は、ビジー時間の細かい粒度が空き時間情報の文字列で返されることを示します。 False の場合のみ、利用可能時間情報の区別が返されることを示します。

戻り値

表す Exchange ユーザーの 30 日間の期間の開始日から指定された日付の午前 0 時に StringString内の各文字は、ユーザーが利用可能な (0) であることを示す値を必要に応じて、マークかどうかビジー状態の時間が仮の予定 (1)、office (3)、またはその他の (2) とします。

次の Visual Basic for Applications (VBA) の例は、現在のユーザーに割り当てられているマネージャーの 60 分を表す各タイム ・ スロットで、空き時間情報を取得するために、 GetFreeBusy メソッドを使用します。 例には、その情報が計算の日付と時刻の最初の空き期間が発生し、 デバッグウィンドウにその情報が表示されます。

Sub GetManagerOpenInterval() 
 Dim oManager As ExchangeUser 
 Dim oCurrentUser As ExchangeUser 
 Dim FreeBusy As String 
 Dim BusySlot As Long 
 Dim DateBusySlot As Date 
 Dim i As Long 
 Const SlotLength = 60 
 'Get ExchangeUser for CurrentUser 
 If Application.Session.CurrentUser.AddressEntry.Type = "EX" Then 
 Set oCurrentUser = _ 
 Application.Session.CurrentUser.AddressEntry.GetExchangeUser 
 'Get Manager 
 Set oManager = oManager.GetExchangeUserManager 
 If oManager Is Nothing Then 
 Exit Sub 
 End If 
 FreeBusy = oManager.GetFreeBusy(Now, SlotLength) 
 For i = 1 To Len(FreeBusy) 
 If CLng(Mid(FreeBusy, i, 1)) = 0 Then 
 'get the number of minutes into the day for free interval 
 BusySlot = (i - 1) * SlotLength 
 'get an actual date/time 
 DateBusySlot = DateAdd("n", BusySlot, Date) 
 'To refine this function, substitute actual 
 'workdays and working hours in date/time comparison 
 If TimeValue(DateBusySlot) >= TimeValue(#8:00:00 AM#) And _ 
 TimeValue(DateBusySlot) <= TimeValue(#5:00:00 PM#) And _ 
 Not (Weekday(DateBusySlot) = vbSaturday Or _ 
 Weekday(DateBusySlot) = vbSunday) Then 
 Debug.Print oManager.name & " first open interval:" & _ 
 vbCrLf & _ 
 Format$(DateBusySlot, "dddd, mmm d yyyy hh:mm AMPM") 
 Exit For 
 End If 
 End If 
 Next 
 End If 
End Sub

関連項目

ExchangeUser オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。