UpdatelistItems - Subfolder under Attachments folder

Oct 31, 2013 at 3:14 PM
Edited Oct 31, 2013 at 3:15 PM
Hello there,

I'm trying to create a folder inside the Attachments folder inside a custom list but I keep getting this error from the responseText:

<ErrorCode>0x80004005</ErrorCode><ErrorText>Cannot complete this action. Please try again.</ErrorText>

The situation here is that I want to move an item and its attachments to another list when they have been approved and this folder will contain the attachments.

This is my code:
    operation: "UpdateListItems",
    async: false,
    listName: "CRHistorico",
    updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
            "<Method ID='1' Cmd='New'>" +
                "<Field Name='FSObjType'>1</Field>" +
                "<Field Name='BaseName'>Attachments/test</Field>" +
            "</Method>" +
    completefunc: function(xData, Status) {
       alert("Status=" + Status + " XML:" + xData.responseText);
Any idea? By the way, I'm running Sharepoint 2007.

Oct 31, 2013 at 3:18 PM
I don't think you can do this. SharePoint manages the location of the attachments and I don't think you're supposed to touch them.

Oct 31, 2013 at 3:26 PM
First thanks for your quick answer Marc!

Second, don't you think that as they are stored like 'usual' files under accessible paths (although auto generated) they could be copied? I'm just guessing here, don't know how (or if possible) to do it but it makes sense for me.

So, under your opinion, is this impossible? And if it's impossible, how would you do it? I'm not asking for the code just for your thoughts :)

Oct 31, 2013 at 3:36 PM
If you take a look at the list in SharePoint Designer, you'll see that attachments are stored in folders like:
Lists/Sales Opportunities/Attachments/40/Doc1.doc
where 40 is the item's ID.

Those folders aren't really available to you for manipulation. If you change the name of a folder, SharePoint can't find the attachments anymore.

Oct 31, 2013 at 4:00 PM
Yep you are right of course, I know how it saves the attachments. But I am wondering... is this a matter of "I shouldn't" or "I can't"? :)

Oct 31, 2013 at 4:10 PM
Like I said, I don't think you can do this. Unless you've seen direct evidence of it working for others, I'd put it in the "I shouldn't" category.

Oct 31, 2013 at 4:14 PM
Ok Marc, thanks for your answers!

I'll keep trying some more time and in case I succeed, I'll share with you the results.

Thanks again!