Skip to content

Commit 90b6cbc

Browse files
committed
#291 - Delete attachments by moving them to the recycle bin
1 parent 34026ad commit 90b6cbc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/services/SPService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class SPService implements ISPService {
103103
headers: { "X-HTTP-Method": 'DELETE', }
104104
};
105105
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
106-
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/items(@itemId)/AttachmentFiles/getByFileName(@fileName)?@listId=guid'${encodeURIComponent(listId)}'&@itemId=${encodeURIComponent(String(itemId))}&@fileName='${encodeURIComponent(fileName.replace(/'/g, "''"))}'`;
106+
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/items(@itemId)/AttachmentFiles/getByFileName(@fileName)/RecycleObject?@listId=guid'${encodeURIComponent(listId)}'&@itemId=${encodeURIComponent(String(itemId))}&@fileName='${encodeURIComponent(fileName.replace(/'/g, "''"))}'`;
107107
const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, spOpts);
108108
} catch (error) {
109109
console.dir(error);

0 commit comments

Comments
 (0)