[英]Office365 Calendar Events For Team Meeting
我正在使用Office365 REST API在ASP.NET中開發一個應用程序。 我需要在office365中安排一個團隊活動,但是在安排該活動之前,我需要檢查所有團隊成員的可用時間。 如果有空位,那么我只需要為團隊設置一個活動。
假設我有3個成員團隊,例如,user1@someone.com,user2@someone.com,user3@clientone.com。 我需要檢查團隊中所有成員的可用時間,並且只需要顯示兼容時間。 假設user1在9:00 am-9:30舉行了計划會議,那么我需要隱藏該時間,因為user1沒有空閑時間。
我怎樣才能做到這一點? 任何想法?
查找會議時間(= Exchange FreeBusy)在預覽https://msdn.microsoft.com/zh-cn/office/office365/api/calendar-rest-operations#Findmeetingtimespreview,但您應該可以通過https:/使用/outlook.office.com/api/beta
干杯格倫
最終,我嘗試使用忙/閑代碼。 我的代碼如下...我正在執行此過程,但是我不知道它是否正確。 我有office365帳戶,並且通過靜默傳遞憑據來創建交換服務器服務。 之后,我將按照以下方式傳遞不同的域參與者信息,如ORGANIZER和REQUIRED。 但是,它返回的所有值不會跳過那些用戶的任何預定會議。
讓我們假設user1@domain.com是ORGANIZER,而user2@anotherdomain.com是需要開會的。 User1的會議安排在每天的7:00-7:30pm,但是當我執行以下腳本時,它顯示我7:00-7:30pm可供會議。 它應該阻止那個時間。 您可以建議對代碼進行一些更改,我是否以正確的方式進行?
private static void GetSuggestedMeetingTimes(ExchangeService service)
{
List<AttendeeInfo> attendees = new List<AttendeeInfo>();
attendees.Add(new AttendeeInfo()
{
SmtpAddress = "user1@mydomain.com",
AttendeeType = MeetingAttendeeType.Organizer
});
attendees.Add(new AttendeeInfo()
{
SmtpAddress = "user2@anotherdomain.com",
AttendeeType = MeetingAttendeeType.Required
});
// Specify options to request free/busy information and suggested meeting times.
AvailabilityOptions availabilityOptions = new AvailabilityOptions();
availabilityOptions.GoodSuggestionThreshold = 49;
availabilityOptions.MaximumNonWorkHoursSuggestionsPerDay = 0;
availabilityOptions.MaximumSuggestionsPerDay = 40;
// Note that 60 minutes is the default value for MeetingDuration, but setting it explicitly for demonstration purposes.
availabilityOptions.MeetingDuration = 30;
availabilityOptions.MinimumSuggestionQuality = SuggestionQuality.Good;
availabilityOptions.DetailedSuggestionsWindow = new TimeWindow(DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));
availabilityOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;
// Return free/busy information and a set of suggested meeting times.
// This method results in a GetUserAvailabilityRequest call to EWS.
GetUserAvailabilityResults results = service.GetUserAvailability(attendees,
availabilityOptions.DetailedSuggestionsWindow,
AvailabilityData.FreeBusyAndSuggestions,
availabilityOptions);
// Display suggested meeting times.
Console.WriteLine("Availability for {0} and {1}", attendees[0].SmtpAddress, attendees[1].SmtpAddress);
Console.WriteLine();
foreach (Suggestion suggestion in results.Suggestions)
{
Console.WriteLine("Suggested date: {0}\n", suggestion.Date.ToShortDateString());
Console.WriteLine("Suggested meeting times:\n");
foreach (TimeSuggestion timeSuggestion in suggestion.TimeSuggestions)
{
Console.WriteLine("\t{0} - {1}\n",
timeSuggestion.MeetingTime.ToShortTimeString(),
timeSuggestion.MeetingTime.Add(TimeSpan.FromMinutes(availabilityOptions.MeetingDuration)).ToShortTimeString());
}
}
int i = 0;
// Display free/busy times.
foreach (AttendeeAvailability availability in results.AttendeesAvailability)
{
Console.WriteLine("Availability information for {0}:\n", attendees[i].SmtpAddress);
foreach (CalendarEvent calEvent in availability.CalendarEvents)
{
Console.WriteLine("\tBusy from {0} to {1} \n", calEvent.StartTime.ToString(), calEvent.EndTime.ToString());
}
i++;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.