tags:

views:

307

answers:

5

Hi all i am using SPWeb.ProcessBatchData() method to batch create folders inside one document library. everything works fine expect after folders have been created, folders all have very strange name. for example if my document library's name is 000, then the folder name's is "1._000". I tried a lot of other properties, but i have no luck to find out how to set the folder name right. Can some one help me on this?

Cheers

+1  A: 

Here's the answer: Robin Meure's Blog

Colin
I read the post before. this is not the solution i am looking for. I still want to use ProcessBatchData instead of web service
Victor
There is no other way it seems....
Colin
A: 

Hi Victor,

you've read my blogpost, could you tell me why you want to use the ProcessBatchData method? It it's for performance reasons, then you it doesn't really matter when using the webservices over the ProcessBatchData method. Just as a FYI, it took me a couple of days to figure out how to get it working properly as well using the ProcessBatchData method and then after running some tests using the webservice there was no real performance loss while handling large amounts of data so I gave up on using the ProcessBatchData method.

Robin Meuré
A: 

Hi Robin: Thanks a lot for your post. There are two reason that I want to use the ProcessBatchData method. First, It seems can process more commands at once than the webservice. I tried both ways. By using ProcessBatchData I can process more than 500 commands at once. But using webservcie, there is only about 200 commands one time. Second, I find I can pass some characters into sharepoint by using ProcessBatchData. But webservice considers them as invalid.

The problem i have now is having problem to update the folders' name. Can you help me on this?

Cheers

Victor
A: 

You are right about the webservices are a bit more strict on the characters you can put in and it cannot process the same amount of requests, but you can work around that I guess :)

What you can do though if you really want to use the ProcessBatchData method is, re-use the result you receive back from the method. If it's correct, you will get all the ListItemId's back from each folder. Using the Id's you can create another batch to rename the Title's of the items.

But if I were you, I would switch and use the webservice and workaronud that :)

Robin Meuré
A: 

Hi,

this is the correct syntax of the XML to create a folder truly titled:

<?xml version="1.0" encoding="utf-8"?> 
<ows:Batch OnError="Continue">
<Method ID="Test">
<SetList Scope="Request">82d62a9a-55ba-49c8-a9b8-68ec965a5931</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="Type">1</SetVar>
<SetVar Name="owsfileref">/sites/1/docs/folder1</SetVar>
</Method>
</ows:Batch>

the critical line is this one:

<SetVar Name="Type">1</SetVar>

"Type" is the accepted alias of the FSObjType field

Regards, Ahmad