exchangefreaks.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add ressource automaticaly

 
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange 2000 Active Directory Integration
Author Message
Angel



Joined: 26 Nov 2007
Posts: 3

PostPosted: Mon Nov 26, 2007 12:40 pm    Post subject: add ressource automaticaly Reply with quote

hy,

The next code send a meeting request. It must reserve a ressource
automaticaly, but it don't do it. It's necessary to accept manualy the
request. why?

For a manualy meeting request, all is ok.

I think there is a problem with the header on the CreateMeetingRequest
sub :
[...]
strHeaderInfo = "" & strReqAttendees & " header:to>" & _
"" & strOptAttendees & "" & _
"" & strMtgResources & ""
[...]

Someone can confirme or not that I must use "" for the
resources?

thank you.




'************************************************************************************
'* SUB : CreateMeetingRequest( ByVal strExchSvrName, ByVal
strMailbox, _
'* ByVal strReqAttendees, ByVal
strOptAttendees, ByVal strMtgResources, _
'* ByVal strUserName, ByVal
strPassWord, _
'* ByVal ApptDateStart, ByVal
ApptDateEnd, ByVal ApptBusyStatus, _
'* ByVal ApptMeetingStatus, ByVal
ApptSubject, ByVal ApptLocation, _
'* ByVal ApptItem, ByVal Periodicity
As Boolean, ByVal PeriodFREQ As String, _
'* ByVal PeriodCOUNT As Integer,
ByVal PeriodINTERVAL As Integer, ByVal PeriodBYDAY As String, _
'* ByVal PeriodWKST As String)
'*
'* Input : - strExchSvrName As String : Exchange server name
'* strMailbox As String : Mailbox folder of the
meeting organizer
'* CalendarFolder As String : Calendar folder used
'* strReqAttendees As String : Required meeting
attendees
'* strOptAttendees As String : Optional meeting
attendees
'* strMtgResources As String : Meeting resources
'* strUserName As String : Username of meeting
creator
'* strPassWord As String : password of meeting
creator
'* ApptDateStart As String : Date Start of meeting
("2007-10-25T10:37:00.000Z")
'* ApptDateEnd, As String : Date End of meeting
("2007-10-25T11:37:00.000Z")
'* ApptBusyStatus As String : Busy Status
'* ApptMeetingStatus As String : Meeting Status
'* ApptSubject, As String : Meeting Subject
'* ApptLocation As String : Meeting Location
'* ApptItem As String : Meeting Filename.eml
'* Periodicity As Boolean : Periodicity of the
meetings (ex : "True")
'* PeriodFREQ As String : Frequency of the
periodicity (ex : "DAILY")
'* PeriodCOUNT As Integer : Interval count of
periodicity (ex : "5")
'* PeriodINTERVAL As Integer : Interval (ex : "1")
'* PeriodBYDAY As String : Day of the
periodicity (ex : "MO,TU,WE,TH,FR")
'* PeriodWKST As String : Week start (ex :
"SU")
'* ExceptedDate As String : Excepted dates (ex :
"2007-11-15T00:00:00.000Z2007-11-21T00:00:00.000Z x:v>")
'* Caution : The
excepted dates must exist on the appointment dates created.
'*
'* Output : - Return string : format date like aaaa-mm-jjThh:mm:ss.
000Z
'*

'************************************************************************************
Sub CreateMeetingRequest(ByVal strExchSvrName As String, ByVal
strMailbox As String, ByVal CalendarFolder As String, _
ByVal strReqAttendees As String, ByVal
strOptAttendees As String, ByVal strMtgResources As String, _
ByVal strUserName As String, ByVal
strPassWord As String, _
ByVal ApptDateStart As String, ByVal
ApptDateEnd As String, ByVal ApptBusyStatus As String, _
ByVal ApptMeetingStatus As String, ByVal
ApptSubject As String, ByVal ApptLocation As String, _
ByVal ApptItem As String, ByVal
Periodicity As Boolean, ByVal PeriodFREQ As String, _
ByVal PeriodUNTIL As String, ByVal
PeriodINTERVAL As Integer, ByVal PeriodBYDAY As String, _
ByVal PeriodWKST As String, ByVal
ExceptedDate As String)

'http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/e2k3/e2k3/_sending_a_meeting_request_webdav.asp

'Need to add msxml6.dll : http://forums.asp.net/p/1060342/1522104.aspx
'for this go to project/build/add_reference/browse and select
the c:\windows\system32\msxml6.dll)
'or add reference : Microsft XML,v6.0

'Sub SendMeetingRequest()

' Variables
Dim strMtgUri As String
Dim strMtgRequestUri As String
Dim strMtgRequest As String
Dim strCalInfo As String
Dim strHeaderInfo As String
Dim strMailInfo As String
Dim strXMLNSInfo As String
Dim bResult As Boolean
Dim strUID As String
Dim strCCInfo As String
Dim strMapiInfo As String
Dim strSubmissionUri As String

'' Exchange server name.
'strExchSvrName = "eint11" '"ExchangeServer"

'' Mailbox folder of the meeting organizer.
'strMailbox = "mfz@heig-vd.ch" '"user1@example.com"

'' Required meeting attendees.
'strReqAttendees = "mfz-full@heig-vd.ch"
'"user1@example.com;user2@example.com"

'' Optional meeting attendees.
'strOptAttendees = "mfz-full@heig-vd.ch; miguel-
angel.fernandez@heig-vd.ch" '"user3@example.com"

'' Meeting resources
'strMtgResources = "" '"meetingroom1@example.com"

'' Username and password of meeting creator.
'strUserName = "einet\mfz" '"Domain\user1"
'strPassWord = "+Usr75Mfz" '"!Password"

' Conversion DateTime to UTC time for the appointment creation
on Exchange server
ApptDateStart =
ConvertFormatDateTimeToDateAppt(CDate(ConvertFormatDateApptToDateTime(ApptDateStart)).ToUniversalTime().ToString())
ApptDateEnd =
ConvertFormatDateTimeToDateAppt(CDate(ConvertFormatDateApptToDateTime(ApptDateEnd)).ToUniversalTime().ToString())

' URI of the meeting item.
strMtgUri = "http://" & strExchSvrName & "/exchange/" & _
strMailbox & "/" & CalendarFolder & "/" & ApptItem

' URI of the meeting request item.
strMtgRequestUri = "http://" & strExchSvrName & "/exchange/" &
_
strMailbox & "/" & CalendarFolder & "/" & "Request_" &
ApptItem

' 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:c=""urn:schemas:calendar:timezoneid"" " & _
"xmlns:mail=""urn:schemas:httpmail:"""

If Periodicity Then
' Set the meeting item properties.
strCalInfo = "" & ApptLocation & " cal:location>" & _
"" & ApptDateStart &
"" & _
"" & ApptDateEnd & " cal:dtend>" & _
"4" & _
"0"
& _
"" & ApptBusyStatus & " cal:busystatus>" & _
"" & ApptMeetingStatus & " cal:meetingstatus>" & _
"0 cal:alldayevent>" & _
"1 cal:responserequested>" & _
"" & _
"FREQ=" & PeriodFREQ & ";UNTIL=" &
DateAMJcompact(PeriodUNTIL) & ";INTERVAL=" & PeriodINTERVAL & _
";BYDAY=" & PeriodBYDAY & ";WKST=" & PeriodWKST & " x:v>" & _
"" & _
"" & _
ExceptedDate & _
"" & _
"2"
Else
' Set the meeting item properties.
strCalInfo = "" & ApptLocation & " cal:location>" & _
"" & ApptDateStart &
"" & _
"" & ApptDateEnd & " cal:dtend>" & _
"4" & _
"0"
& _
"" & ApptBusyStatus & " cal:busystatus>" & _
"" & ApptMeetingStatus & " cal:meetingstatus>" & _
"0 cal:alldayevent>" & _
"1 cal:responserequested>" & _
"2"
End If

' Set the required and optional attendees of the meeting
' and the meeting resources.
strHeaderInfo = "" & strReqAttendees & " header:to>" & _
"" & strOptAttendees & "" & _
"" & strMtgResources & ""

' Set the subject of the meeting.
strMailInfo = "" & ApptSubject & " mail:subject>" & _
"" & ApptLocation & " mail:htmldescription>"

' Build the XML body of the PROPPATCH request.
strMtgRequest = "" & _
"" & _
"" & _
"urn:content-classes:appointment g:contentclass>" & _
"IPM.Appointment e:outlookmessageclass>" & _
strMailInfo & _
strCalInfo & _
strHeaderInfo & _
"1" & _
"" & _
""

bResult = False

' Create the meeting item in the organizer's calendar folder.
bResult = CreateMeeting(strMtgUri, _
strMtgRequest, _
strUserName, _
strPassWord)

If bResult Then
' Get urn:schemas:calendar:uid property, which needs to be
included in the meeting request.
strUID = FindMeetingUID(strMtgUri, _
strMailbox, _
strPassWord)

If strUID "" Then
' Set the meeting request item contentclass and
outlookmessage class properties.
strCCInfo = "urn:content-
classes:calendarmessage" & _

"IPM.Schedule.Meeting.Request e:outlookmessageclass>"

' Set the meeting request item MAPI properties.
strMapiInfo = "1 mapi:finvited>" & _
"1 mapi:responsestatus>" & _
"0 mapi:responsestate>" & _
"1 mapi:response_requested>" & _
"3 mapi:apptstateflags>" & _
"1 mapi:busystatus>" & _
"2 mapi:intendedbusystatus>"

' Build the XML request body of the meeting request
item.
strMtgRequest = "" & _
"" & _
"" & _
"" & _
strCCInfo & _
strMailInfo & _
strCalInfo & "" & strUID & " cal:uid>" & _
strHeaderInfo & _
strMapiInfo & _
"" & _
"" & _
""

' Create the meeting request item in the organizer's
calendar.
bResult = False

bResult = CreateMeeting(strMtgRequestUri, _
strMtgRequest, _
strMailbox, _
strPassWord)

If bResult 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(strMtgRequestUri, _
strSubmissionUri,
_
strUserName, _
strPassWord)
End If
End If
End If

End Sub

'************************************************************************************
'* FUNCTION : CreateMeeting( _
'* ByVal strURL, _
'* ByVal strMtgRequest, _
'* ByVal strUserName, _
'* ByVal strPassWord)
'* As Boolean
'*
'* Input :
'* - strURL As String : URI of the meeting item
'* - strMtgRequest As String : Meeting request
'* - strUserName As String : Username of meeting
creator
'* - strPassWord As String : Password of meeting
creator
'*
'*
'* Output : - Return Boolean
'*

'************************************************************************************
Function CreateMeeting( _
ByVal strURL, _
ByVal strMtgRequest, _
ByVal strUserName, _
ByVal strPassWord) As Boolean

' Use MSXML 4.0
Dim xmlReq As MSXML2.XMLHTTP40

On Error GoTo ErrHandler

' Create the XMLHTTP object.
xmlReq = CreateObject("Microsoft.XMLHTTP")

' Open the request object with the PROPPATCH method and
' specify that it will be sent asynchronously.
xmlReq.open("PROPPATCH", strURL, False, strUserName,
strPassWord)
xmlReq.setRequestHeader("Content-Type", "text/xml")

' Send the request.
xmlReq.send(strMtgRequest)

' The PROPPATCH request was successful.
If (xmlReq.status >= 200 And xmlReq.status < 300) Then
'MsgBox("Meeting item created successfully.")
Console.WriteLine("Meeting item created successfully.")
CreateMeeting = True

' Get error info.
Else
MsgBox("CreateMeeting : Meeting item not created
successfully. PROPPATCH status: " & xmlReq.status & _
": " & xmlReq.statusText)
Console.WriteLine("CreateMeeting : Meeting item not
created successfully. PROPPATCH status: " & xmlReq.status & _
": " & xmlReq.statusText)
CreateMeeting = False
End If

ErrExit:
xmlReq = Nothing
Exit Function
ErrHandler:
MsgBox("CreateMeeting ErrHandler: Error creating meeting item:
" & Err.Number & ": " & Err.Description)
Console.WriteLine("CreateMeeting ErrHandler: Error creating
meeting item: " & Err.Number & ": " & Err.Description)
CreateMeeting = False
'Throw New ArgumentException("Error at CreateMeeting." &
Chr(13) & "(" + Err.Number + ": " + Err.Description + ")")
'Exit Function
End Function

'************************************************************************************
'* FUNCTION : FindMeetingUID( _
'* ByVal strURL, _
'* ByVal strMtgRequest, _
'* ByVal strUserName, _
'* ByVal strPassWord)
'* As Boolean
'*
'* Input :
'* - strURL As String : URI of the meeting item
'* - strMtgRequest As String : Meeting request
'* - strUserName As String : Username of meeting
creator
'* - strPassWord As String : Password of meeting
creator
'*
'*
'* Output : - Return Boolean
'*

'************************************************************************************
Function FindMeetingUID(ByVal strURL, _
ByVal strUserName, _
ByVal strPassWord) As String

' Variables.
Dim xmlReq As MSXML2.XMLHTTP40
Dim xmldom As MSXML2.DOMDocument
Dim xmlRoot As MSXML2.IXMLDOMElement
Dim xmlNode As MSXML2.IXMLDOMNode
Dim xmlAttr As MSXML2.IXMLDOMAttribute
Dim strUIDRequest As String
Dim baseName As String

On Error GoTo ErrHandler

' Build the PROPFIND request body.
strUIDRequest = "" & _
"" & _
"" & _
"" & _
"" & _
""

' Create the XMLHTTP object.
xmlReq = CreateObject("Microsoft.XMLHTTP")

' Open the request object with the PROPFIND method and
' specify that it will be sent asynchronously.
xmlReq.open("PROPFIND", strURL, False, strUserName,
strPassWord)
xmlReq.setRequestHeader("Content-Type", "text/xml")
xmlReq.setRequestHeader("Depth", "0")

' Send the PROPFIND request.
xmlReq.send(strUIDRequest)

' The PROPFIND request was successful.
If (xmlReq.status >= 200 And xmlReq.status < 300) Then
'MsgBox("Meeting item urn:schemas:calendar:uid found.")

' Get the urn:schemas:calendar: from the XML response
body.
xmldom = xmlReq.responseXML
xmlRoot = xmldom.documentElement
For Each xmlAttr In xmlRoot.attributes
If xmlAttr.text = "urn:schemas:calendar:" Then
baseName = xmlAttr.baseName
Exit For
End If
Next

' Extract the urn:schemas:calendar:uid property value.
xmlNode = xmlRoot.selectSingleNode("//" & baseName &
":uid")
FindMeetingUID = xmlNode.text

' Get error info.
Else
MsgBox("FindMeetingUID : Failed to find meeting item
urn:schemas:calendar:uid. " & "PROPFIND status: = " & _
xmlReq.status & ": " & xmlReq.statusText)
Console.WriteLine("FindMeetingUID : Failed to find meeting
item urn:schemas:calendar:uid. " & "PROPFIND status: = " & _
xmlReq.status & ": " & xmlReq.statusText)

FindMeetingUID = ""
End If

ErrExit:
xmlReq = Nothing
xmldom = Nothing
xmlRoot = Nothing
xmlNode = Nothing
xmlAttr = Nothing
Exit Function
ErrHandler:
MsgBox("FindMeetingUID ErrHandler : Error finding meeting item
urn:schemas:calendar:uid. " & Err.Number & ": " & Err.Description)
Console.WriteLine("FindMeetingUID ErrHandler : Error finding
meeting item urn:schemas:calendar:uid. " & Err.Number & ": " &
Err.Description)
FindMeetingUID = ""

End Function

'************************************************************************************
'* FUNCTION : SubmitMeetingRequest( _
'* ByVal strSrcURL, _
'* ByVal strSubmissionURL, _
'* ByVal strMailbox, _
'* ByVal strPassWord)
'* As Boolean
'*
'* Input :
'* - strSrcURL As String : URL of the meeting
Source
'* - strSubmissionURL As String : URL of the meeting
Submission
'* - strMailbox As String : Mailbox folder of the
meeting organizer
'* - strPassWord As String : Password of meeting
creator
'*
'*
'* Output : - Return Boolean
'*

'************************************************************************************

Function SubmitMeetingRequest(ByVal strSrcURL, _
ByVal strSubmissionURL, _
ByVal strMailbox, _
ByVal strPassWord) As Boolean

' Use MSXML 4.0.
Dim xmlReq As MSXML2.XMLHTTP40
On Error GoTo ErrHandler

' Create the XMLHTTP object.
xmlReq = CreateObject("Microsoft.xmlhttp")

' Open the request object with the MOVE method and
' specify that it will be sent asynchronously.
xmlReq.open("MOVE", strSrcURL, False, strMailbox, strPassWord)
xmlReq.setRequestHeader("Destination", strSubmissionURL)
xmlReq.setRequestHeader("Content-Type", "message/rfc822")

' Send the MOVE request.
xmlReq.send()

' The MOVE request was successful.
If (xmlReq.status >= 200 And xmlReq.status < 300) Then
'MsgBox("Meeting request successfully sent.")
SubmitMeetingRequest = True

' Permissions error.
ElseIf xmlReq.status = 401 Then
SubmitMeetingRequest = False
MsgBox("SubmitMeetingRequest : You don't have permission
to send the meeting request.")
Console.WriteLine("SubmitMeetingRequest : You don't have
permission to send the meeting request.")

' Get error info.
Else
SubmitMeetingRequest = False
MsgBox("SubmitMeetingRequest : Meeting request not
successfully sent. MOVE status: " & xmlReq.status & ": " &
xmlReq.statusText)
Console.WriteLine("SubmitMeetingRequest : Meeting request
not successfully sent. MOVE status: " & xmlReq.status & ": " &
xmlReq.statusText)
End If

ErrExit:
xmlReq = Nothing
Exit Function
ErrHandler:
MsgBox("SubmitMeetingRequest ErrHandler : Error sending
meeting request: " & Err.Number & ": " & Err.Description)
Console.WriteLine("SubmitMeetingRequest ErrHandler : Error
sending meeting request: " & Err.Number & ": " & Err.Description)
SubmitMeetingRequest = False
End Function

Archived from group: microsoft>public>exchange2000>active>directory>integration
Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Exchange 2007 - Ressource Mailbox config Hi A user would like to book a room on a weekly basis over a period of 6 month. The problem is that if the room is already booked only on one of these timeslots, the whole series is rejected. I would like to configure the ressource mailbox, that the booki

Email address spoof I have a customer using Exchange 2003 and one of the email accounts has been spoofed. How do I prevent this from happening again and how do I track down who is doing the spoofing?

Exch 2003 Data growth estimation Hi there, I am wondering if there is any tools or good method to calculate the data growth of the Exch 2003 server. We are running Exch2003 SP2 and have 16 mail stores. Of course, I can maually check each store size every day, but that will be a big pai

The e-mail account does not exist at the organization this m I have a Microsoft SBS 2003 with SP2 running Exchange. When users try to send emails between each other in the same domain, everything is ok, But when they SEND EMAILS TO PEOPLE HAVING THE SAME DOMAIN BUT IN ANOTHER COUNTRY THEY GET THIS MESSAGE : xxxxxx

Moving to a new server Hardware Due to problems with the hardware on our current Exchange 2003 server. I need to decommission this server. What is necessary to move the current database to the new server. The current setup is a single server setup. It is a Wi
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange 2000 Active Directory Integration All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group