I have used following code to make a Meeting Request ,How can I add
attachment to it.
Public Sub SendMeetingRequest(ByVal strMailbox As String, ByVal strUserName
As String, ByVal strDomain As String, ByVal strPassword As String, ByVal
strSubject As String, ByVal strReqAttendees As String, ByVal strOptAttendees
As String, ByVal strMtgItem As String, ByVal strMtgRequestItem As String,
ByVal strBody As String, ByVal strStarDate As String, ByVal strEndDate As
String)
' Variables Declaration
Dim strExchSvrName As String
'Dim strMailbox As String
Dim strCalendarUri As String
Dim strMtgResources As String
Dim strMtgRequest As String
Dim strMailInfo As String
Dim strCalInfo As String
Dim strXMLNSInfo As String
Dim strHeaderInfo As String
Dim bResult As Boolean
Dim MyCredentialCache As System.Net.ICredentials
Dim strUID As String
Dim strMapiInfo As String
Dim strCCInfo As String
Dim strSubmissionUri As String
Dim credential As NetworkCredential
Dim icredential As ICredentials
Try
' Exchange server name
strExchSvrName = "imailhyd.satyam.com"
credential = New NetworkCredential(strUserName, strPassword)
icredential = credential
' Required meeting attendees.
' URI of the user's calendar folder.
strCalendarUri = "http://" & strExchSvrName & "/exchange/" _
& strMailbox & "/Calendar/"
' Create a new CredentialCache object and fill it with the network
' credentials required to access the server.
'MyCredentialCache = New System.Net.CredentialCache
'MyCredentialCache = (New System.Uri(strCalendarUri), "MAPI", _
' New
System.Net.NetworkCredential(strUserName, strPassword, strDomain) _
' )
' XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=""DAV:"" " _
& "xmlns:e=""http://schemas.microsoft.com/exchange/"" " _
& "xmlns:mapi=""http://schemas.microsoft.com/mapi/"" " _
& "xmlns:mapit=""http://schemas.microsoft.com/mapi/proptag/""
" _
& "xmlns:x=""xml:"" xmlns:cal=""urn:schemas:calendar:"" " _
&
"xmlns:dt=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" " _
& "xmlns:header=""urn:schemas:mailheader:"" " _
& "xmlns:mail=""urn:schemas:httpmail:"""
' Set the meeting item properties. strStarDate, strEndDate
2007-01-20T23:00:00+05:30 2007-01-23T23:30:00+05:30
'YYYY-MM-DDThh:mm:ss
'strStarDate = CType(strStarDate,
DateTime).ToString("YYYY-MM-DDThh:mm:ss")
'strStarDate = strStarDate + "+5:30"
'strEndDate = CType(strEndDate,
DateTime).ToString("YYYY-MM-DDThh:mm:ss")
'strEndDate = +"+5:30"
strCalInfo = "meetappt Location" _
& "" & strStarDate &
"" _
& "" & strEndDate &
"" _
& "0" _
& "BUSY" _
& "CONFIRMED" _
& "0" _
& "
dt:dt=""boolean"">1"
' Set the required and optional attendees and meeting
' resources of the meeting.
strHeaderInfo = "" & strReqAttendees & "" _
& "" & strOptAttendees & "" _
& "" & strMtgResources & "" _
& "text/plain"
' Set the subject of the meeting.
strMailInfo = "" & strSubject & "" _
& "" & strBody &
""
' & "True"
'& "" & "attachment" &
"" _
' &
"text/plain"
' Build the XML body of the PROPPATCH request.
strMtgRequest = "" _
& "" _
& "" _
&
"urn:content-classes:appointment" _
&
"IPM.Appointment" _
& strMailInfo _
& strCalInfo _
& strHeaderInfo _
& "1" _
& "" _
& ""
' Create the meeting item in the organizer's calendar folder.
bResult = False
bResult = CreateMeeting(strCalendarUri & strMtgItem,
strMtgRequest, icredential)
If bResult = True Then
strUID = FindMeetingUID(strCalendarUri & strMtgItem,
icredential)
If Not strUID = "" Then
' Set the meeting request item contentclass and
outlookmessage class properties.
strCCInfo =
"urn:content-classes:calendarmessage" _
&
"IPM.Schedule.Meeting.Request"
' Set the meeting request item MAPI properties.
strMapiInfo = "
dt:dt=""boolean"">1" _
& "
dt:dt=""int"">1" _
& "
dt:dt=""int"">0" _
& "
dt:dt=""boolean"">1" _
& "
dt:dt=""int"">3" _
& "
dt:dt=""int"">1" _
& "
dt:dt=""int"">2"
' Build the XML request body of the meeting request item.
strMtgRequest = "" _
& "" _
& "" _
& strCCInfo _
& strMailInfo _
& strCalInfo & "" & strUID & "" _
& strHeaderInfo _
& strMapiInfo _
& ""
' Create the meeting request item in the organizer's
calendar.
bResult = False
bResult = CreateMeeting(strCalendarUri &
strMtgRequestItem, _
strMtgRequest, icredential)
If bResult = True Then
' Build the mail submission URI of the meeting
organizer.
strSubmissionUri = "http://" & strExchSvrName &
"/exchange/" _
& strMailbox & "/##DavMailSubmissionURI##/"
' MOVE the meeting request item to mail submission
URI (send
' the meeting request).
bResult = False
bResult = SubmitMeetingRequest(strCalendarUri &
strMtgRequestItem, _
strSubmissionUri, _
icredential)
End If
End If
End If
Catch ex As Exception
' Catch any exceptions.
Throw ex
End Try
End Sub
Archived from group: microsoft>public>exchange>applications