Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
    
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 '13 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. –  Marc D Anderson Jan 23 '13 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 '13 at 4:48
    
Yes. The Web Services are extremely reliable. If you send good data and get a response, it worked. –  Marc D Anderson Jan 23 '13 at 5:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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