|
|
|
date: Sun, 8 Jan 2006 17:32:03 -0800,
group: microsoft.public.exchange2000.development
back
Re: WebDAV VC++ MOVE items performs replace instead of move
I don't know where there are any c++ examples I've got a VBS one that might
help, You do need to list all the source Items you want to copy including
the full Href to the item you want to move. You need to be carefully with
Bmove as with this method its possible after you have moved an item from the
inbox its possible that another item will then get assigned that same href
value for the item you just move. When you then attempt to move the new item
into the same folder the new item will over write the old item.
eg
servername = "server"
mailbox = "mailbox"
sDestinationURL = "http://" & servername & "/exchange/" & mailbox & "/eee/"
sSourceURL = "http://" & servername & "/exchange/" & mailbox & "/inbox/"
Set XMLreq = CreateObject("Microsoft.xmlhttp")
XMLreq.open "BMOVE", sSourceURL, False
XMLreq.setRequestHeader "Destination", sDestinationURL
xmlstr = "<?xml version=""1.0"" ?>"
xmlstr = xmlstr & "<D:move xmlns:D=""DAV:"">"
xmlstr = xmlstr & "<D:target>"
xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-3.EML</D:href>"
xmlstr = xmlstr & "</D:target>"
xmlstr = xmlstr & "<D:target>"
xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-2.EML</D:href>"
xmlstr = xmlstr & "</D:target>"
xmlstr = xmlstr & "<D:target>"
xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-1.EML</D:href>"
xmlstr = xmlstr & "</D:target>"
xmlstr = xmlstr & "</D:move>"
XMLreq.setRequestHeader "Content-Type", "text/xml;"
XMLreq.setRequestHeader "Translate", "f"
XMLreq.setRequestHeader "Content-Length:", Len(xmlstr)
XMLreq.send(xmlstr)
If (XMLreq.Status >= 200 And XMLreq.Status < 300) Then
Wscript.echo "Success! " & "Results = " & XMLreq.Status & ": " &
XMLreq.statusText
ElseIf XMLreq.Status = 401 then
Wscript.echo "You don't have permission to do the job!."
Else
Wscript.echo "Request Failed. Results = " & XMLreq.Status & ": " &
XMLreq.statusText
End If
Cheers
Glen
"yoavm" wrote in message
news:BAC25313-91DB-407D-8A6D-86C7F87A0803@microsoft.com...
> Thanks Glen.
> Batch Move looks suitable.
> Do you know where I can find C++ example for using the BMOVE?
> I can't make it work. I get Status Codes of 400.
> Probably the problem is with the Target XML Element.
>
> Should I list each one of the items although I want to move everything?
>
> Thanks,
> yoavm
>
>
> "Glen Scales [MVP]" wrote:
>
>> You might want to look into doing a BMOVE instead
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_bmove.asp
>> if you do a select first you should be able to use the results of the
>> select
>> to then build the BMOVE request.
>>
>> The other way that should work is to set the depth to infinity,noroot
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_depth_header.asp
>> but i've never been able to get this to work except on DELETE
>>
>>
>> Cheers
>> Glen
>>
>> "yoavm" wrote in message
>> news:7A182F35-E4F0-4D2E-AB7A-7B144E08A4CC@microsoft.com...
>> > Hello,
>> >
>> > I'm attempting to use WebDAV with VC++ to move all items from one
>> > folder
>> > to
>> > another. Source URL is http://<server>/exchange/administrator/Inbox
>> > Target URL: is
>> > http://<server>/exchange/administrator/Backup
>> >
>> > Instead of moving the items the result is folder Inbox renamed to
>> > Backup.
>> > (Folder Inbox deleted and new folder Backup has the content of what
>> > used
>> > to
>> > be Inbox).
>> >
>> > What should I do to force WebDAV just move the items and not performs
>> > Rename?
>> >
>> > Thanks,
>> > Yoavm
>>
>>
>>
date: Tue, 17 Jan 2006 13:33:05 +1100
author: Glen Scales [MVP]
Re: WebDAV VC++ MOVE items performs replace instead of move
Hello Glen,
You are the man.
It works perfectly.
Thanks,
yoavm
"Glen Scales [MVP]" wrote:
> I don't know where there are any c++ examples I've got a VBS one that might
> help, You do need to list all the source Items you want to copy including
> the full Href to the item you want to move. You need to be carefully with
> Bmove as with this method its possible after you have moved an item from the
> inbox its possible that another item will then get assigned that same href
> value for the item you just move. When you then attempt to move the new item
> into the same folder the new item will over write the old item.
>
> eg
>
> servername = "server"
> mailbox = "mailbox"
>
> sDestinationURL = "http://" & servername & "/exchange/" & mailbox & "/eee/"
> sSourceURL = "http://" & servername & "/exchange/" & mailbox & "/inbox/"
> Set XMLreq = CreateObject("Microsoft.xmlhttp")
> XMLreq.open "BMOVE", sSourceURL, False
> XMLreq.setRequestHeader "Destination", sDestinationURL
> xmlstr = "<?xml version=""1.0"" ?>"
> xmlstr = xmlstr & "<D:move xmlns:D=""DAV:"">"
> xmlstr = xmlstr & "<D:target>"
> xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-3.EML</D:href>"
> xmlstr = xmlstr & "</D:target>"
> xmlstr = xmlstr & "<D:target>"
> xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-2.EML</D:href>"
> xmlstr = xmlstr & "</D:target>"
> xmlstr = xmlstr & "<D:target>"
> xmlstr = xmlstr & "<D:href>" & sSourceURL & "/test-1.EML</D:href>"
> xmlstr = xmlstr & "</D:target>"
> xmlstr = xmlstr & "</D:move>"
> XMLreq.setRequestHeader "Content-Type", "text/xml;"
> XMLreq.setRequestHeader "Translate", "f"
> XMLreq.setRequestHeader "Content-Length:", Len(xmlstr)
> XMLreq.send(xmlstr)
>
> If (XMLreq.Status >= 200 And XMLreq.Status < 300) Then
> Wscript.echo "Success! " & "Results = " & XMLreq.Status & ": " &
> XMLreq.statusText
> ElseIf XMLreq.Status = 401 then
> Wscript.echo "You don't have permission to do the job!."
> Else
> Wscript.echo "Request Failed. Results = " & XMLreq.Status & ": " &
> XMLreq.statusText
> End If
>
> Cheers
> Glen
>
> "yoavm" wrote in message
> news:BAC25313-91DB-407D-8A6D-86C7F87A0803@microsoft.com...
> > Thanks Glen.
> > Batch Move looks suitable.
> > Do you know where I can find C++ example for using the BMOVE?
> > I can't make it work. I get Status Codes of 400.
> > Probably the problem is with the Target XML Element.
> >
> > Should I list each one of the items although I want to move everything?
> >
> > Thanks,
> > yoavm
> >
> >
> > "Glen Scales [MVP]" wrote:
> >
> >> You might want to look into doing a BMOVE instead
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_bmove.asp
> >> if you do a select first you should be able to use the results of the
> >> select
> >> to then build the BMOVE request.
> >>
> >> The other way that should work is to set the depth to infinity,noroot
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_depth_header.asp
> >> but i've never been able to get this to work except on DELETE
> >>
> >>
> >> Cheers
> >> Glen
> >>
> >> "yoavm" wrote in message
> >> news:7A182F35-E4F0-4D2E-AB7A-7B144E08A4CC@microsoft.com...
> >> > Hello,
> >> >
> >> > I'm attempting to use WebDAV with VC++ to move all items from one
> >> > folder
> >> > to
> >> > another. Source URL is http://<server>/exchange/administrator/Inbox
> >> > Target URL: is
> >> > http://<server>/exchange/administrator/Backup
> >> >
> >> > Instead of moving the items the result is folder Inbox renamed to
> >> > Backup.
> >> > (Folder Inbox deleted and new folder Backup has the content of what
> >> > used
> >> > to
> >> > be Inbox).
> >> >
> >> > What should I do to force WebDAV just move the items and not performs
> >> > Rename?
> >> >
> >> > Thanks,
> >> > Yoavm
> >>
> >>
> >>
>
>
>
date: Tue, 17 Jan 2006 08:22:03 -0800
author: yoavm
|
|