问题描述
我正在尝试找出我们作为一个部门(约100人)在会议上花费的时间.为简单起见,我们可以将所有繁忙时间都视为会议中的繁忙时间.但是我不知道该怎么做,我希望有人有个主意
I am trying to find out how much time we spend in meetings as a division (~100 people). For simplicity's sake, we can consider all busy hours as those in meetings. However I can't figure out how to do it and I was hoping someone has an idea
推荐答案
在网络上有使用EWS API进行此类操作的示例.例如,您可以使用的想法:
There are examples of using the EWS API for this sort of thing all over the web. For example, ideas for you to work with:
使用EWS托管API获取约会.以下代码示例演示如何使用EWS托管API检索介于指定开始时间和结束时间之间的用户约会.
Get appointments by using the EWS Managed API. The following code example shows how to use the EWS Managed API to retrieve a user's appointments that fall between a specified start and end time.
// Initialize values for the start and end times, and the number of appointments to retrieve.
DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddDays(30);
const int NUM_APPTS = 5;
// Initialize the calendar folder object with only the folder ID.
CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
// Set the start and end time and number of appointments to retrieve.
CalendarView cView = new CalendarView(startDate, endDate, NUM_APPTS);
// Limit the properties returned to the appointment's subject, start time, and end time.
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
// Retrieve a collection of appointments by using the calendar view.
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
Console.WriteLine("\nThe first " + NUM_APPTS + " appointments on your calendar from " + startDate.Date.ToShortDateString() +
" to " + endDate.Date.ToShortDateString() + " are: \n");
foreach (Appointment a in appointments)
{
Console.Write("Subject: " + a.Subject.ToString() + " ");
Console.Write("Start: " + a.Start.ToString() + " ");
Console.Write("End: " + a.End.ToString());
Console.WriteLine();
}
基本Powershell脚本,可使用EWS托管API显示日历中的约会
Basic Powershell script to show appointments from a calendar using the EWS Managed API
$MailboxName = 'SomeUserEmailALias'
$StartDate = Get-Date
$EndDate = (Get-Date).AddDays(7)
$DllPath = 'C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll'
[void][Reflection.Assembly]::LoadFile($DllPath)
$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010)
$Service.AutodiscoverUrl($MailboxName)
$FolderID = New-Object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$MailboxName)
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($Service,$FolderID)
$Calendarview.PropertySet = New-Object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$CalendarResult = $CalendarFolder.FindAppointments($CalendarView)
foreach ($Appointment in $CalendarResult.Items)
{
$Propset = New-Object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$Appointment.load($Propset)
New-Object -TypeName PSObject -Property @{
Appointment = $Appointment.Subject.ToString()
Start = $Appointment.Start.ToString()
End = $Appointment.End.ToString()
Organizer = $Appointment.Organizer.ToString()
}
}
https://gsexdev.blogspot.com /2009/11/basic-powershell-script-to-show.html
[Powershell脚本EWS]使用EWS托管API处理日历项目
[Powershell script EWS] Working with Calendar Items using EWS managed API
$Folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId `
([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$MailboxToImpersonate)
$cal=[Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$Folderid)
$StartDate =(Get-Date)
$EndDate =(get-date).AddDays(7)
$CalendarView = New-Object Microsoft.Exchange.WebServices.Data.CalendarView `
($StartDate,$EndDate,$itemsView)
$findCalItems = $service.FindAppointments($Cal.Id,$CalendarView)
param
(
$mailbox="SomeUserEmailALias",
$itemsView=1000,
$userName=$cred.UserName,
$password=$cred.GetNetworkCredential().password,
$StartDate =(Get-Date),
$EndDate =(get-date).AddDays(7) # find meeting upto next 7 days.
)
#set EWS URL and Web Service DLL file location path below.
$uri=[system.URI] "https://outlook.office365.com/ews/exchange.asmx"
$dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
Import-Module $dllpath
#Set Exchange Version
$ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion)
$service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials -ArgumentList $userName, $password
$service.url = $uri
$service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId `
([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SMTPAddress,$mailbox);
$Folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId `
([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$mailbox)
$cal=[Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$Folderid)
#Define the calendar view
$CalendarView = New-Object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate,$itemsView)
$findCalItems = $service.FindAppointments($Cal.Id,$CalendarView)
$report = $findCalItems | Select Start,End,Duration,AppointmentType,Subject,Location,
Organizer,DisplayTo,DisplayCC,HasAttachments,IsReminderSet,ReminderDueBy
$report | Export-Csv $($mailbox + "-Meetings.csv") -NoTypeInformation
https://www .linkedin.com/pulse/powershell-script-ews-working-calendar-items-using-managed-chauhan
用于将日历信息导出到CSV文件的EWS脚本.
EWS Script to Export Calendar Information to a CSV file.
.Synopsis:
Script which creates a function "Export-CalendarInformation" which can be used to export details of each calendar items to a CSV file.
. Description:
Using EWS API and authorized credentials (can use an account with application impersonation permission) this script exports below details of each calendar item in a mailbox calendar to CSV file. This script will return
StartTime, EndTime, Duration, Type, Subject, Location, Organizer, Attendees, AppointmentState, Notes, HasAttachments, IsReminderSet
https://gallery.technet.microsoft.com/EWS -Script-to-Export-c76a0ad4
这篇关于使用Exchange Web服务在会议上花费的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!