Howto: VB - An example to create a public folder with storage limit settings.
In this example, the following properties are set during the folder creation.
outlookfolderclass
contentclass
The warning limit in KB
Prohibit Post at (KB).
Maximum item Size (KB)
addressbookdisplayname
isreadonly
ishidden
When reading and setting certain properties, it’s necessary to use the exchange admin path. This path provides special admin privileges. An Exchange Admin login must be used when using this path.
Private Sub cmdMakeFolder_Click()
Dim XMLreq As New MSXML2.XMLHTTP40
Dim sReq As String
Dim parsePhone As String
Dim sSourceURL As String
Set XMLreq = New MSXML2.XMLHTTP40
sSourceURL = "https:// myexserver /Exadmin/admin/MYDOM.EXTEST.MYCOMP.COM/PUBLIC%20FOLDERS/myfolder"
' Note: This URL is broken down as:
' myexserver is the Exchange box name
' MYDOM.EXTEST.MYCOMP.COM is the full domain name the Exchange box is in.
' Exadmin/admin is a special designation giving the login user higher level privs.
' Exchange explorer may/may not need the %20 in PUBLIC%20FOLDERS
' The account you use to log in with Must have full blown Exchange admin privs and be
' a domain acct.
'XMLreq.open "MKCOL", sSourceURL, False, "Administrator", "Pxxxx"
' If the Exchange is the DC, you probably dont have to specify the DC to login
XMLreq.open "MKCOL", sSourceURL, False, "mydom\myexserver ", "Pxxxxxxx"
' Here Exchange box is not the DC
XMLreq.setRequestHeader "Content-Type", "text/xml"
sReq = "<?xml version='1.0'?>"
sReq = sReq & "<a:propertyupdate xmlns:a='DAV:' xmlns:e='https://schemas.microsoft.com/exchange/' " & _
"xmlns:p='https://schemas.microsoft.com/mapi/proptag/'>"
sReq = sReq & "<a:set><a:prop>" & vbCrLf
sReq = sReq & "<e:outlookfolderclass>IPF.Folder</e:outlookfolderclass>" & vbCrLf
' Folder class for outlook
sReq = sReq & "<a:contentclass>urn:content-classes:folder</a:contentclass>" & vbCrLf
' Folder content class
sReq = sReq & "<a:isreadonly>1</a:isreadonly>" & vbCrLf ' Read only
sReq = sReq & "<a:ishidden>1</a:ishidden>" & vbCrLf ' Hidden
sReq = sReq & "<p:x67790003>1</p:x67790003>" & vbCrLf
'Use the quotas specified by other properties.
sReq = sReq & "<e:storagequotaissuewarninglimit>200</e:storagequotaissuewarninglimit>" & vbCrLf
'Issue warning at (Kb).
sReq = sReq & "<p:x67210003>1</p:x67210003>" & vbCrLf 'Prohibit post at (Kb).
sReq = sReq & "<p:x67220003>1</p:x67220003>" & vbCrLf 'Maximum item size (Kb).
sReq = sReq & "<e:addressbookdisplayname>Something</e:addressbookdisplayname>" & vbCrLf
sReq = sReq & "</a:prop></a:set></a:propertyupdate>"
XMLreq.send sReq
Debug.Print "xmlReq.Status = " & XMLreq.Status
If XMLreq.Status = "201" Or XMLreq.Status = "207" Then
MsgBox "The folder has been created. Status is " & XMLreq.statusText, vbCritical, "Folder Created!!"
Else
' Note: Error 405 can mean permissions problem on item already exists.
MsgBox "The folder has not been created. Status is " & XMLreq.statusText, vbCritical, " Folder not Created!!"
End If
End Sub
Comments
Anonymous
December 16, 2008
I have been able to create a folder with WEBDAV. What is the trick to mail enabling that folder?Anonymous
November 07, 2012
Hi, Your articules are very interesting. What involve to create a Webdav Server in vb.net from scratch? can you tell me the points?, I am new en that I dont know how to start. Thank you so much!