1

We have a SharePoint that's hit quota and the admins are insisting that we will get no more quota increases. As a result, I have to move a bunch of attachments of the SharePoint server onto a file server. We want to maintain the link to the SharePoint item, so I'm using the web services in a Perl script to copy the attachment hyperlinks to an HTML field. So far, so good.

I don't want to have to manually delete attachments for almost 5,000 items over three dozen lists, so I'd like to do it through the web services. The issue is I don't want to delete the attachment unless the write to the HTML field actually worked. After that, I want to make sure that the attachment deletion actually happened. What response should I check in each case?

1 Answer 1

0

When you use UpdateListItems, the response is the item as it now looks. If the attachment isn't there, then the update was successful.

4
  • So going in reverse order, do I have to call GetAttachmentCollection and check that against the list of attachments for that item? For UpdateListItems, I'm not sure what you mean by the item as it looks now. Does the UpdateListItemsResponse include the item?
    – Carlos
    Jan 22, 2013 at 21:46
  • Yes, the UpdateListItems response will echo what you asked the operation to do. Give it a try and you'll see what I mean. Jan 23, 2013 at 2:09
  • Okay, I found it. Using that I'm able to compare the field I'm updating with the text I want it to be and if they match, I know it worked. As for DeleteAttachment, from what I can see, the response is empty when it works, and I haven't been able to find a way to test a failed deletion. If there is no attachment to delete, I get no response at all. Do you think it's safe to treat "got a response" as "worked"?
    – Carlos
    Jan 23, 2013 at 4:48
  • Yes. The Web Services are extremely reliable. If you send good data and get a response, it worked. Jan 23, 2013 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.