pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
753 stars 305 forks source link

Property 'delete' does not exist on type 'DirectoryObject' #2960

Closed kbeeveer46 closed 5 months ago

kbeeveer46 commented 5 months ago

Major Version

3.x

Minor Version Number

23

Target environment

SharePoint Framework

Additional environment details

SPFx 1.18.2

Expected or Desired Behavior

The documentation says there is a delete method on directory objects https://pnp.github.io/pnpjs/graph/directoryobjects/#delete-directoryobject

When I use the sample code from the documentation it throws an error

Observed Behavior

Error message. See screen shot below.

Steps to Reproduce

import { graphfi, SPFx as graphSPFx } from "@pnp/graph";
import "@pnp/graph/groups";
import "@pnp/graph/directory-objects";

const graph = graphfi().using(graphSPFx(this._context));

const group = await graph.groups.filter(`displayName eq 'Client Portal MDP43838 GENERAL'`).select("id")();

if (group?.length && group[0].id)
{
      const deleted = await graph.directoryObjects.getById(group[0].id).delete()
}

image

bcameron1231 commented 5 months ago

Hi. Our apologies, you are correct, this is a bug. I have just submitted a PR for this. It will go out in today's release.

github-actions[bot] commented 5 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.