【发布时间】:2017-06-12 20:50:42
【问题描述】:
我设法使用 EWS 命令行为模拟帐户创建了约会。
但我想包括一个房间(交换室邮箱)作为资源/位置。
在我的脚本中,我添加了以下两个命令行:
$NewAppointment.Location($RoomName)$NewAppointment.Resources.Add($RoomMail)
$RoomName 和 $RoomMail 可以通过 Get-MailBox 命令行找到:
$Room = Get-MailBox $CSV.Room$RoomName = $Room.DisplayName$RoomMail = $Room.UserPrincipalName or $Room.PrimarySmtpAddress
编辑:
我添加了以下代码块:
$NewGuid = newGuid
$LocationURIGuid = $NewGuid.Guid
$LocationURI = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($LocationURIGuid, "LocationUri", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String)
$NewAppointment.SetExtendedProperty($LocationURI,$RoomMail)
$NewGuid = newGuid
$LocationSourceGuid = $NewGuid.Guid
$LocationSource = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($LocationSourceGuid, "LocationSource", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer)
$NewAppointment.SetExtendedProperty($LocationSource,5)
$NewGuid = newGuid
$LocationDisplayNameGuid = $NewGuid.Guid
$LocationDisplayName = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($LocationSourceGuid, "LocationDisplayName", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer)
$NewAppointment.SetExtendedProperty($LocationDisplayName,$Room)
newGuid 是一个函数:
function newGuid() { return [guid]::NewGuid() }
错误是:
为“ExtendedPropertyDefinition”和参数计数找到多个不明确的重载:“3”。
【问题讨论】:
标签: powershell exchangewebservices