get calendar using uid
Dim
esb As New ExchangeServiceBinding()
esb.Credentials =
New Net.NetworkCredential(ConfigurationManager.AppSettings("ExchUserName"), ConfigurationManager.AppSettings("ExchPassword"), ConfigurationManager.AppSettings("ExchDomain"))
'Provide the URL
esb.Url = ConfigurationManager.AppSettings(
"EsbURL")
esb.RequestServerVersionValue =
New RequestServerVersion()
esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1
'which properties will be returned
Dim itemProperties As New ItemResponseShapeType()
itemProperties.BaseShape = DefaultShapeNamesType.AllProperties
' Tell it you only want to look in the calendar folder
Dim folderIDArray As DistinguishedFolderIdType() = New DistinguishedFolderIdType(0) {}
folderIDArray(0) =
New DistinguishedFolderIdType()
folderIDArray(0).Id = DistinguishedFolderIdNameType.calendar
'Locate the field for search
Dim field As New PathToUnindexedFieldType() 'PathToUnindexedFieldType '
field.FieldURI = UnindexedFieldURIType.calendarUID
Dim fieldValue As New ConstantValueType()
fieldValue.Value = "a0mS00000004k8fIAA*Kiran, 234234242, Num1, Booked, some service*O"
Dim expr As New ContainsExpressionType()
expr.ContainmentModeSpecified =
True
expr.ContainmentMode = ContainmentModeType.Substring
'Prefixed
expr.ContainmentComparisonSpecified =
True
expr.ContainmentComparison = ContainmentComparisonType.IgnoreCase
expr.Constant = fieldValue
expr.Item = field
Dim restriction As New RestrictionType()
restriction.Item = expr
'Form the FindItem request
Dim findItemRequest As New FindItemType()
findItemRequest.Traversal = ItemQueryTraversalType.Shallow
findItemRequest.ItemShape = itemProperties
findItemRequest.ParentFolderIds = folderIDArray
findItemRequest.Restriction = restriction
Dim
findItemResponse As FindItemResponseType = esb.FindItem(findItemRequest)
For
Each firmt As FindItemResponseMessageType In findItemResponse.ResponseMessages.Items
sr.WriteLine(
"220")
If firmt.RootFolder Is Nothing Then
sr.WriteLine(
"firmt.RootFolder Is Nothing")
Continue For
End If
If firmt.RootFolder IsNot Nothing AndAlso firmt.RootFolder.TotalItemsInView > 0 Then
For Each appt As CalendarItemType In DirectCast(firmt.RootFolder.Item, ArrayOfRealItemsType).Items
sr.WriteLine(
"Appointment Item ID:" & appt.ItemId.Id)
ApptID = appt.ItemId.Id
ChangeKey = appt.ItemId.ChangeKey
sr.WriteLine(
"Item Found")
Exit For
Next
End If
Next