2017-06-12 96 views
0

我设法使用EWS命令行创建一个模拟帐户的约会。Exchange Web Services(EWS) - 任命资源

但我想包括一个房间(Exchange Room Mailbox)作为资源/位置。

在我的剧本我已经添加下面的两个命令行:

  • $NewAppointment.Location($RoomName)
  • $NewAppointment.Resources.Add($RoomMail)

$RoomName$RoomMailGet-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() } 

的错误是: “3”:发现 “ExtendedPropertyDefinition” 和参数计数

多暧昧重载。

回答

0

你只需要使用load()来重新加载预约,一旦你已经创建了它,那么你应该看到的是创建约会时,那些充满out.That信息的属性被popualted和createItem操作,不返回如此直到你发出另一个GetItem请求才会出现。

编辑

您需要添加使用扩展属性,EWS不会为你做它,例如

 Guid PropGuid = Guid.Parse("{A719E259-2A9A-4FB8-BAB3-3A9F02970E4B}"); 
     ExtendedPropertyDefinition LocationURI = new ExtendedPropertyDefinition(PropGuid, "LocationUri", MapiPropertyType.String); 
     ExtendedPropertyDefinition LocationSource = new ExtendedPropertyDefinition(PropGuid, "LocationSource", MapiPropertyType.Integer); 
     ExtendedPropertyDefinition LocationDisplayName = new ExtendedPropertyDefinition(PropGuid, "LocationDisplayName", MapiPropertyType.String); 
     newapt.SetExtendedProperty(LocationURI, "[email protected]"); 
     newapt.SetExtendedProperty(LocationSource, 5); 
     newapt.SetExtendedProperty(LocationDisplayName, "Somewhere"); 

编辑2 PowerShell代码

$PropGuid = [Guid]::Parse("{A719E259-2A9A-4FB8-BAB3-3A9F02970E4B}") 
    $LocationURI = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($PropGuid, "LocationUri", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String) 
    $NewAppointment.SetExtendedProperty($LocationURI,$RoomMail) 

    $LocationSource = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($PropGuid, "LocationSource", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer) 
    $NewAppointment.SetExtendedProperty($LocationSource,5) 

    $LocationDisplayName = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($PropGuid, "LocationDisplayName", 

    [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer) 
    $NewAppointment.SetExtendedProperty($LocationDisplayName,$Room) 
+0

谢谢您的回答此信息。 事实是Load()或不是我添加的房间不像房间。 在命令行或web应用程序中,位置始终显示为地址。 – NivekLR

+0

您可以在您的问题中添加一些说明,因为您没有给出足够的细节或代码供任何人回答 –

+0

好。对不起:) 当我想创建一个会议/约会作为资源/位置与房间模拟帐户我使用$ NewAppointment.Resources.Add($房间)命令行。这个命令添加一个资源,但是这个不是真实的房间。 Outlook OWA上的结果是位置条目显示为经典位置(Bing搜索),而不是像房间。 – NivekLR

相关问题