Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » how to read the appointment in calendar using exchange server

Messages: 1
Karma: 0
Send a private message to this user
we are using kerio mail server...
we read the appointments in calender(kerio mail server to .net application)

i am get some error.......
networkcredential is nothing(username,password)
The remote server returned an error: (401) Unauthorized

plz help me... how to read the appointment using kerio mail server

this is source code......

Private Sub Retriving2()
Dim Request As System.Net.HttpWebRequest
Dim Response As System.Net.HttpWebResponse
Dim MyCredentialCache As System.Net.CredentialCache
Dim strPassword As String
Dim strDomain As String
Dim strUserName As String
Dim strCalendarURI As String
Dim strQuery As String
Dim bytes() As Byte
Dim RequestStream As System.IO.Stream
Dim ResponseStream As System.IO.Stream
Dim ResponseXmlDoc As System.Xml.XmlDocument
Dim HrefNodes As System.Xml.XmlNodeList
Dim SizeNodes As System.Xml.XmlNodeList
Dim SubjectNodeList As System.Xml.XmlNodeList
Dim LocationNodeList As System.Xml.XmlNodeList
Dim StartTimeNodeList As System.Xml.XmlNodeList
Dim EndTimeNodeList As System.Xml.XmlNodeList
Dim BusyStatusNodeList As System.Xml.XmlNodeList
Dim InstanceTypeNodeList As System.Xml.XmlNodeList
strUserName = "sathish<_a.t_>"
strPassword = "shlok12345;-"
strDomain = ""
strCalendarURI = "http://shlok38:8070/exchange/sathish/calendar/"
strQuery = "<?xml version=""1.0""?>" & _
"<g:searchrequest xmlns:g=""DAV:"">" & _
"<g:sql>SELECT ""urn:schemas:calendar:location"", ""urn:schemas:httpmail:subject"", " & _
"""urn:schemas:calendar:dtstart"", ""urn:schemas:calendar:dtend"", " & _
"""urn:schemas:calendar:busystatus"", ""urn:schemas:calendar:instancetype"" " & _
"FROM Scope('SHALLOW TRAVERSAL OF """ & strCalendarURI & """') " & _
"WHERE NOT ""urn:schemas:calendar:instancetype"" = 1 " & _
"AND ""DAV:contentclass"" = 'urn:content-classes:appointment' " & _
"AND ""urn:schemas:calendar:dtstart"" > '2007/09/10 00:00:00' " & _
"ORDER BY ""urn:schemas:calendar:dtstart"" ASC" & _
MyCredentialCache = New System.Net.CredentialCache
MyCredentialCache.Add(New System.Uri(strCalendarURI), "NTLM", New System.Net.NetworkCredential(strUserName, strPassword, strDomain))
Request = CType(System.Net.WebRequest.Create(strCalendarURI), _
Request.Credentials = MyCredentialCache
Request.Method = "SEARCH"
bytes = System.Text.Encoding.UTF8.GetBytes(strQuery)
Request.ContentLength = bytes.Length
RequestStream = Request.GetRequestStream()
RequestStream.Write(bytes, 0, bytes.Length)
Request.ContentType = "text/xml"
Request.Headers.Add("Translate", "F")
Response = CType(Request.GetResponse(), System.Net.HttpWebResponse)
ResponseStream = Response.GetResponseStream()
ResponseXmlDoc = New System.Xml.XmlDocument
HrefNodes = ResponseXmlDoc.GetElementsByTagName("a:href")
SubjectNodeList = ResponseXmlDoc.GetElementsByTagName("e:subject")
LocationNodeList = ResponseXmlDoc.GetElementsByTagName("d:location")
StartTimeNodeList = ResponseXmlDoc.GetElementsByTagName("d:dtstart")
EndTimeNodeList = ResponseXmlDoc.GetElementsByTagName("d:dtend")
BusyStatusNodeList = ResponseXmlDoc.GetElementsByTagName("d:busystatus")
InstanceTypeNodeList = ResponseXmlDoc.GetElementsByTagName("d:instancetype")
If SubjectNodeList.Count > 0 Then
MsgBox("Calendar items...")
Dim i As Integer
For i = 0 To SubjectNodeList.Count - 1
MsgBox(" Subject: " + SubjectNodeList(i).InnerText)
MsgBox(" Location: " + LocationNodeList(i).InnerText)
MsgBox(" Start time: " + StartTimeNodeList(i).InnerText)
MsgBox(" End time: " + EndTimeNodeList(i).InnerText)
MsgBox(" Busy status: " + BusyStatusNodeList(i).InnerText)
If InstanceTypeNodeList(i).InnerText = "0" Then
MsgBox(" Instance type: 0-Single appointment")
ElseIf InstanceTypeNodeList(i).InnerText = "1" Then
MsgBox(" Instance type: 1-Master recurring appointment")
ElseIf InstanceTypeNodeList(i).InnerText = "2" Then
MsgBox(" Instance type: 2-Single instance, recurring appointment")
ElseIf InstanceTypeNodeList(i).InnerText = "3" Then
MsgBox(" Instance type: 3-Exception to a recurring appointment")
MsgBox(" Instance type: Unknown")
End If
MsgBox("No calendar items found ...")
End If
Catch ex As Exception
End Try
End Sub

[Updated on: Wed, 12 September 2007 06:41]

Pavel Dobry (Kerio)

Messages: 5245
Karma: 251
Send a private message to this user
Try to use Basic authentication. NTLM does not work in WebDAV.

Messages: 1
Karma: 0
Send a private message to this user
Did you ever get this to work?
Previous Topic: Kerio Connect 7.2.0 RC1 Outlook Connector Bug
Next Topic: Problem with Connect 7.2 RC1 and BlackBerry Connector
Goto Forum:

Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Tue Oct 24 00:29:48 CEST 2017

Total time taken to generate the page: 0.00422 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.