当前位置: 首页 > 知识库问答 >
问题:

如何通过uniqueId获得与EWS的约会

姬裕
2023-03-14
Dim rdvEncours As DevisRdv = GetRdv(ConnectedUser,LesDatas) 
Appointment.Save(New FolderId(WellKnownFolderName.Calendar, rdvEncours.Collaborateur.Mail))
rdvEncours.ExchangeId = Appointment.Id.UniqueId
LesDatas.SaveChange();
Public Function FindAppointment(Service As ExchangeService, UnikId As String) As Appointment
    Dim CalendarFolder As CalendarFolder = CalendarFolder.Bind(Service, New FolderId(WellKnownFolderName.Calendar, ml), New PropertySet(BasePropertySet.IdOnly, FolderSchema.TotalCount))

    ' Set the number of items to the smaller of the number of items in the Contacts folder Or 1000.
    Dim numItems As Integer = If(CalendarFolder.TotalCount < 1000, CalendarFolder.TotalCount, 1000)

    ' Instantiate the item view with the number of items to retrieve from the contacts folder.
    ' To keep the request smaller, send only the display name.
    Dim View As ItemView = New ItemView(numItems) With {.PropertySet = New PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.End, AppointmentSchema.Start)}

    ' Create a searchfilter to check the subject of the tasks.
    Dim searchFilter As SearchFilter.SearchFilterCollection = New SearchFilter.SearchFilterCollection From {New SearchFilter.IsEqualTo(ItemSchema.Id, UnikId)}

    ' Retrieve the items in the Calendar folder with the properties you selected.
    Dim taskItems = Service.FindItems(New FolderId(WellKnownFolderName.Calendar, ml), searchFilter, View)

    If taskItems.Count = 1 AndAlso TypeOf taskItems.Items(0) Is Appointment Then
        Return taskItems.Items(0)
        HelperJournal.WriteEntry("Find Rdv by id") 'TODO:A mettre ne commentaire quand vérifier
    Else
        Return Nothing
    End If

End Function
Dim FoundTask As Appointment = FindAppointment(ConnectToExchange(), rdvEncours.ExchangeId)
If (FoundTask IsNot Nothing) Then FoundTask.Delete(DeleteMode.HardDelete)

共有1个答案

梁韬
2023-03-14

2020年6月4日的格伦评论是正确的回应

 Dim Appointment As New Appointment(service) With {
     .Subject = "MySubject",
     .Start = rdvEncours.DteInter,
     .Body = "MyBody",
     .Importance = Importance.High
 }
 Appointment.End = Appointment.Start.AddHours(1)
 Dim MaClef As String = getRandomString(256)
 Appointment.SetExtendedProperty(GetCustomKeyAppointment, MaClef)

 Appointment.Save(New FolderId(WellKnownFolderName.Calendar, rdvEncours.Collaborateur.Mail))
 rdvEncours.ExchangeId = MaClef
 LesDatas.SaveChanges()

并且,就像你需要一个新的自定义键的引用,在一个模块中

 ' Get the GUID for the property set.
Private Const MyCustomKeySetId As String = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

Public Function GetCustomKeyAppointment() As ExtendedPropertyDefinition
    Return New ExtendedPropertyDefinition(New Guid(MyCustomKeySetId), "Mykey", MapiPropertyType.String)
End Function

找到你的约会

 Public Function FindAppointment(Service As ExchangeService, UnikId As String) As Appointment
    Dim CalendarFolder As CalendarFolder = CalendarFolder.Bind(Service, New FolderId(WellKnownFolderName.Calendar, ml), New PropertySet(BasePropertySet.IdOnly, FolderSchema.TotalCount))

    ' Set the number of items to the smaller of the number of items in the Contacts folder Or 1000.
    Dim numItems As Integer = If(CalendarFolder.TotalCount < 1000, CalendarFolder.TotalCount, 1000)

    ' Instantiate the item view with the number of items to retrieve from the contacts folder.
    ' To keep the request smaller, send only the display name.
    Dim View As ItemView = New ItemView(numItems) With {.PropertySet = New PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.End, AppointmentSchema.Start)}

    ' Create a searchfilter to check the subject of the tasks.
    Dim searchFilter As SearchFilter = New SearchFilter.IsEqualTo(GetCustomKeyAppointment, UnikId)

    ' Retrieve the items in the Calendar folder with the properties you selected.
    Dim taskItems = Service.FindItems(New FolderId(WellKnownFolderName.Calendar, ml), searchFilter, View)

    If taskItems.Count = 1 AndAlso TypeOf taskItems.Items(0) Is Appointment Then
        Return taskItems.Items(0)

    Else
        Return Nothing
    End If

End Function
 类似资料:
  • 文档页面显示boto3支持服务配额,但看起来不支持,或者我在这里做了什么不正确的事情? https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/service-quotas.html

  • 我需要在其中运行 但是,有一个错误是我无法从maven存储库中获取pom文件。

  • 我正在开发一个服务,我想用它来监控标签和实施标签策略。 一个计划中的功能是检测带有相应键不允许的值的资源。 我已经可以列出具有特定标记键的资源的ARN,现在我希望根据无效值筛选此资源列表。要做到这一点,我想使用每个资源标签的ARN查询一个列表,然后根据标签中有无效值的资源进行过滤。 我有我想做一些类似来获取指定资源的标记。 我正在使用nodejs,但我很乐意使用基于AWS cli或任何其他可以在脚

  • 问题内容: 因此,既然HTML5引入了更改浏览器历史记录的方法,那么网站开始将其与Ajax结合使用,而不是更改URL的片段标识符。 可悲的是,这意味着这些呼叫无法再由来检测。 我的问题是: 是否有可靠的方法(黑客?;))来检测网站何时使用?该规范未声明有关引发的事件的任何信息(至少我找不到任何东西)。 我试图创建一个Facade,并用我自己的JavaScript对象替换了它,但是它根本没有任何效果

  • 我正在尝试使用weld在我的JavaSE程序中实现依赖注入,但在使用应用程序范围的生产者时遇到了问题。这是我用最少的代码解决的问题。类: 注射点: 我希望它的生成是: 所有这些都在一个主类中绑定在一起: 当我尝试运行此命令时,我得到以下异常: 线程“main”org.jboss.weld.exceptions中出现异常。DeploymentException:WELD-001410:注入点[Bac

  • 问题内容: 我试图弄清楚如何通过可能与“ co” 一起获得承诺的价值: 调用的函数不是生成器,而是普通函数。有了上面的,但是我想要解析的值。是否合作或其他一些库有这样做的方法吗? 问题答案: 是的, 公司 可以做到。您必须在调用中包装父函数: 内在将成为解决价值。如果承诺被拒绝,则可以通过基本声明来纠正错误。