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 

Problem creating Contacts in a Public Folder

 
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange 2000 Development
Author Message
jens



Joined: 06 Dec 2007
Posts: 2

PostPosted: Thu Dec 06, 2007 2:00 pm    Post subject: Problem creating Contacts in a Public Folder Reply with quote

I'm trying to import contact information from a database into a Public Folder
Contactlist using PROPPATCH, however I keep getting the error "Bad Request"
regardless of how much or little information I put in the XML.

I've pasted the short code for trying to create a new contact in the public
folder "test" below. Any help would be greatly appreciated.

' Declare the variables that you will use.
Dim objRequest
Dim strBody As String
Dim strURL As String

' Specify the URL of the new object that you will create.
strURL = "http://texas/public/test/"
' Create an HTTP request object.
objRequest = CreateObject("MSXML2.ServerXMLHTTP")

strBody = "" & _
" xmlns:e=""http://schemas.microsoft.com/exchange/"">" & _
"" & _
"" & _
"urn:content-classes:person" & _
"IPM.Contact" & _
"JoLynn" & _
"Julie" & _
"Dobney" & _
"JoLynn J. Dobney" & _
"Dobney, JoLynn" & _
"" & _
"" & _
""

' Open the request object and assign the PROPPATCH method to it.
objRequest.open("PROPPATCH", strURL, False, username, password)
' Set the required headers for the request.
objRequest.setRequestHeader("Content-Type", "text/xml")
objRequest.setRequestHeader("Translate", "F")
objRequest.setRequestHeader("Content-Length", Len(strBody))

' Send the request. Use the XML document as the body.
Try
objRequest.send(strBody)

'Display the results.
If (objRequest.Status >= 200 And objRequest.Status < 300) Then
MsgBox("Success! " & "Results = " & objRequest.Status & _
": " & objRequest.statusText)
ElseIf objRequest.Status = 401 Then
MsgBox("You do not have permission to do the job. " & _
"Please check your permissions on this item.")
Else
MsgBox("Request Failed. Results = " & objRequest.Status & _
": " & objRequest.statusText)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
objRequest = Nothing

Archived from group: microsoft>public>exchange2000>development
Back to top
View user's profile Send private message
Lee Derbyshire [MVP]



Joined: 05 Aug 2007
Posts: 363

PostPosted: Fri Dec 07, 2007 6:48 pm    Post subject: Re: Problem creating Contacts in a Public Folder Reply with quote

"jens" wrote in message @microsoft.com...
> I'm trying to import contact information from a database into a Public
> Folder
> Contactlist using PROPPATCH, however I keep getting the error "Bad
> Request"
> regardless of how much or little information I put in the XML.
>
> I've pasted the short code for trying to create a new contact in the
> public
> folder "test" below. Any help would be greatly appreciated.
>
> ' Declare the variables that you will use.
> Dim objRequest
> Dim strBody As String
> Dim strURL As String
>
> ' Specify the URL of the new object that you will create.
> strURL = "http://texas/public/test/"
> ' Create an HTTP request object.
> objRequest = CreateObject("MSXML2.ServerXMLHTTP")
>
> strBody = "" & _
> " > xmlns:e=""http://schemas.microsoft.com/exchange/"">" & _
> "" & _
> "" & _
> "urn:content-classes:person" & _
> "IPM.Contact" & _
> "JoLynn" & _
> "Julie" & _
> "Dobney" & _
> "JoLynn J. Dobney" & _
> "Dobney, JoLynn" & _
> "" & _
> "" & _
> ""
>
> ' Open the request object and assign the PROPPATCH method to it.
> objRequest.open("PROPPATCH", strURL, False, username, password)
> ' Set the required headers for the request.
> objRequest.setRequestHeader("Content-Type", "text/xml")
> objRequest.setRequestHeader("Translate", "F")
> objRequest.setRequestHeader("Content-Length", Len(strBody))
>
> ' Send the request. Use the XML document as the body.
> Try
> objRequest.send(strBody)
>
> 'Display the results.
> If (objRequest.Status >= 200 And objRequest.Status < 300) Then
> MsgBox("Success! " & "Results = " & objRequest.Status & _
> ": " & objRequest.statusText)
> ElseIf objRequest.Status = 401 Then
> MsgBox("You do not have permission to do the job. " & _
> "Please check your permissions on this item.")
> Else
> MsgBox("Request Failed. Results = " & objRequest.Status & _
> ": " & objRequest.statusText)
> End If
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
> objRequest = Nothing

The destination URL can't be just the folder, you will need to provide a
new, unique URL if you want to create an item. E.g.

strURL = "http://texas/public/test/whatever-20071207-1347-85962.eml"

Lee.

--
______________________________________

Outlook Web Access For PDA , OWA For WAP
www.leederbyshire.com
email a@t leederbyshire d.0.t c.0.m
______________________________________
Back to top
View user's profile Send private message
jens



Joined: 06 Dec 2007
Posts: 2

PostPosted: Fri Dec 07, 2007 4:15 pm    Post subject: Re: Problem creating Contacts in a Public Folder Reply with quote

Hi Lee,

Thanks for the response, but even if I add some unique .eml extension to the
URL I get a bad request error. It's quite frustrating since everything looks
to be correct.

"Lee Derbyshire [MVP]" wrote:

> "jens" wrote in message
> @microsoft.com...
> > I'm trying to import contact information from a database into a Public
> > Folder
> > Contactlist using PROPPATCH, however I keep getting the error "Bad
> > Request"
> > regardless of how much or little information I put in the XML.
> >
> > I've pasted the short code for trying to create a new contact in the
> > public
> > folder "test" below. Any help would be greatly appreciated.
> >
> > ' Declare the variables that you will use.
> > Dim objRequest
> > Dim strBody As String
> > Dim strURL As String
> >
> > ' Specify the URL of the new object that you will create.
> > strURL = "http://texas/public/test/"
> > ' Create an HTTP request object.
> > objRequest = CreateObject("MSXML2.ServerXMLHTTP")
> >
> > strBody = "" & _
> > " > > xmlns:e=""http://schemas.microsoft.com/exchange/"">" & _
> > "" & _
> > "" & _
> > "urn:content-classes:person" & _
> > "IPM.Contact" & _
> > "JoLynn" & _
> > "Julie" & _
> > "Dobney" & _
> > "JoLynn J. Dobney" & _
> > "Dobney, JoLynn" & _
> > "" & _
> > "" & _
> > ""
> >
> > ' Open the request object and assign the PROPPATCH method to it.
> > objRequest.open("PROPPATCH", strURL, False, username, password)
> > ' Set the required headers for the request.
> > objRequest.setRequestHeader("Content-Type", "text/xml")
> > objRequest.setRequestHeader("Translate", "F")
> > objRequest.setRequestHeader("Content-Length", Len(strBody))
> >
> > ' Send the request. Use the XML document as the body.
> > Try
> > objRequest.send(strBody)
> >
> > 'Display the results.
> > If (objRequest.Status >= 200 And objRequest.Status < 300) Then
> > MsgBox("Success! " & "Results = " & objRequest.Status & _
> > ": " & objRequest.statusText)
> > ElseIf objRequest.Status = 401 Then
> > MsgBox("You do not have permission to do the job. " & _
> > "Please check your permissions on this item.")
> > Else
> > MsgBox("Request Failed. Results = " & objRequest.Status & _
> > ": " & objRequest.statusText)
> > End If
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > End Try
> > objRequest = Nothing
>
> The destination URL can't be just the folder, you will need to provide a
> new, unique URL if you want to create an item. E.g.
>
> strURL = "http://texas/public/test/whatever-20071207-1347-85962.eml"
>
> Lee.
>
> --
> ______________________________________
>
> Outlook Web Access For PDA , OWA For WAP
> www.leederbyshire.com
> email a@t leederbyshire d.0.t c.0.m
> ______________________________________
>
>
>
Back to top
View user's profile Send private message
Lee Derbyshire [MVP]



Joined: 05 Aug 2007
Posts: 363

PostPosted: Sat Dec 08, 2007 1:03 am    Post subject: Re: Problem creating Contacts in a Public Folder Reply with quote

Next, I would try removing the contact properties from the code one at a
time to see if you can isolate the one that is causing the problem.

"jens" wrote in message @microsoft.com...
> Hi Lee,
>
> Thanks for the response, but even if I add some unique .eml extension to
> the
> URL I get a bad request error. It's quite frustrating since everything
> looks
> to be correct.
>
> "Lee Derbyshire [MVP]" wrote:
>
>> "jens" wrote in message
>> @microsoft.com...
>> > I'm trying to import contact information from a database into a Public
>> > Folder
>> > Contactlist using PROPPATCH, however I keep getting the error "Bad
>> > Request"
>> > regardless of how much or little information I put in the XML.
>> >
>> > I've pasted the short code for trying to create a new contact in the
>> > public
>> > folder "test" below. Any help would be greatly appreciated.
>> >
>> > ' Declare the variables that you will use.
>> > Dim objRequest
>> > Dim strBody As String
>> > Dim strURL As String
>> >
>> > ' Specify the URL of the new object that you will create.
>> > strURL = "http://texas/public/test/"
>> > ' Create an HTTP request object.
>> > objRequest = CreateObject("MSXML2.ServerXMLHTTP")
>> >
>> > strBody = "" & _
>> > " >> > xmlns:e=""http://schemas.microsoft.com/exchange/"">" & _
>> > "" & _
>> > "" & _
>> > "urn:content-classes:person" & _
>> > "IPM.Contact" & _
>> > "JoLynn" & _
>> > "Julie" & _
>> > "Dobney" & _
>> > "JoLynn J. Dobney" & _
>> > "Dobney, JoLynn" & _
>> > "" & _
>> > "" & _
>> > ""
>> >
>> > ' Open the request object and assign the PROPPATCH method to it.
>> > objRequest.open("PROPPATCH", strURL, False, username, password)
>> > ' Set the required headers for the request.
>> > objRequest.setRequestHeader("Content-Type", "text/xml")
>> > objRequest.setRequestHeader("Translate", "F")
>> > objRequest.setRequestHeader("Content-Length", Len(strBody))
>> >
>> > ' Send the request. Use the XML document as the body.
>> > Try
>> > objRequest.send(strBody)
>> >
>> > 'Display the results.
>> > If (objRequest.Status >= 200 And objRequest.Status < 300) Then
>> > MsgBox("Success! " & "Results = " & objRequest.Status & _
>> > ": " & objRequest.statusText)
>> > ElseIf objRequest.Status = 401 Then
>> > MsgBox("You do not have permission to do the job. " & _
>> > "Please check your permissions on this item.")
>> > Else
>> > MsgBox("Request Failed. Results = " & objRequest.Status & _
>> > ": " & objRequest.statusText)
>> > End If
>> > Catch ex As Exception
>> > MsgBox(ex.Message)
>> > End Try
>> > objRequest = Nothing
>>
>> The destination URL can't be just the folder, you will need to provide a
>> new, unique URL if you want to create an item. E.g.
>>
>> strURL = "http://texas/public/test/whatever-20071207-1347-85962.eml"
>>
>> Lee.
>>
>> --
>> ______________________________________
>>
>> Outlook Web Access For PDA , OWA For WAP
>> www.leederbyshire.com
>> email a@t leederbyshire d.0.t c.0.m
>> ______________________________________
>>
>>
>>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Public folder contain .(dot) throw exception Hi, I am using to get public folder details from exchange. If a folder is named like MyIni.Ini, MyApp.exe and so On, WebDav throw exception. Could you please tell me the escape character for .(dot ) to use? Thank you Regards

create "public Folder(Contact)" by using webDAV Hi All, I want to create a public by using WebDAV I use MkCOLMEthod, however, my Query is wrong, how to write a Query? my Query is: String query ="
Creating a .MSG file in C++ Hi, I want to make a module to create a .msg file from scratch in C++/win32 using MAPI. Does anybody know how to do this? Thanks in advance.

Creating Forms for Exchange How do we create forms for use in Exchange. I've got a client with Exchange and we want either to add on or replace the resource scheduling dialog (or whatever it is) for reserving conference rooms. We want to add information about the room, show a pictur

Creating User Accounts & Mailboxes Hi, I'm struggling a little here. Have a home grown web based application that we use to create user accounts in AD. I'm trying to modify this to include creating the Exchange 2000 mailbox also (I'm not a programmer). I understand I need to use CDOEXM to
Post new topic   Reply to topic    exchangefreaks.com Forum Index -> MS Exchange 2000 Development 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