Skip to content

Commit

Permalink
#291 - Delete attachments by moving them to the recycle bin
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed May 17, 2019
1 parent 34026ad commit 90b6cbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/SPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class SPService implements ISPService {
headers: { "X-HTTP-Method": 'DELETE', }
};
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
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, "''"))}'`;
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, "''"))}'`;
const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, spOpts);
} catch (error) {
console.dir(error);
Expand Down

0 comments on commit 90b6cbc

Please sign in to comment.