From 866b7d5dc628c6b574c8f348b90da94f85b1978a Mon Sep 17 00:00:00 2001 From: Pierre Jochem Date: Tue, 30 Aug 2016 16:09:25 +0200 Subject: [PATCH] Add & delete attachments --- sharepoint/lists/attachments.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sharepoint/lists/attachments.py b/sharepoint/lists/attachments.py index a9c4943..59a47bb 100644 --- a/sharepoint/lists/attachments.py +++ b/sharepoint/lists/attachments.py @@ -20,10 +20,14 @@ def __iter__(self): yield SharePointAttachment(self, url.text) def delete(self, url): - raise NotImplementedError + xml = SP.DeleteAttachment(SP.listName(self.list_id), SP.listItemID(str(self.row_id)), SP.url(url)) + response = self.opener.post_soap(LIST_WEBSERVICE, xml, + soapaction='http://schemas.microsoft.com/sharepoint/soap/DeleteAttachment') def add(self, filename, content): - raise NotImplementedError + xml = SP.AddAttachment(SP.listName(self.list_id), SP.listItemID(str(self.row_id)), SP.fileName(filename), SP.attachment(content)) + response = self.opener.post_soap(LIST_WEBSERVICE, xml, + soapaction='http://schemas.microsoft.com/sharepoint/soap/AddAttachment') def open(self, url): return self.opener.open(url)