tavikukko / Chrome-SP-Editor

Extension for creating and updating files (js, css) in SharePoint Online from Developer Tools
122 stars 39 forks source link

Cannot delete a List field by using the delete() function #72

Closed navarrorc closed 4 years ago

navarrorc commented 4 years ago

I can't delete a field from a List using the delete() function, in the console I get TypeError: list.fields.getByTitle(...).delete is not a function

To reproduce:

Try to delete a field by following the instructions found at https://pnp.github.io/pnpjs/sp/fields/#delete-a-field

pnpjs_console_cannot_delete_field

tavikukko commented 4 years ago

Hi @navarrorc and thanks for reporting. Might be a bug actually in PnPjs?

tavikukko commented 4 years ago

issue to PnPjs

navarrorc commented 4 years ago

@tavikukko Thank you for creating an issue on the PnPjs repo. I will use the code that you provided when reporting the issue.

import { SPHttpClient } from "@pnp/sp";

(async () => {

  const client = new SPHttpClient()
  await client.delete(`https://tenant.sharepoint.com/sites/sitecollection/_api/web/lists/getbytitle('testlist')/fields/getbytitle('testcolumn')`)

})().catch(console.log)
tavikukko commented 4 years ago

Closing as the issue is in PnPjs. Thanks!