Delete a site collection via Microsoft Graph?

%3CLINGO-SUB%20id%3D%22lingo-sub-233609%22%20slang%3D%22en-US%22%3EDelete%20a%20site%20collection%20via%20Microsoft%20Graph%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-233609%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20taking%20my%20first%20baby%20steps%20with%20the%20Microsoft%20Graph%20and%20I%20was%20wondering%20how%20to%20perform%20a%20task%20such%20as%20deleting%20a%20classic%20team%20site.%20I%20know%20how%20to%20GET%20it%20as%20described%20in%20the%20official%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fresources%2Fsite%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAPI%20reference%3C%2FA%3E.%20However%2C%20for%20SharePoint%20it%20only%20seems%20to%20mentions%20GET%20requests%20and%20DELETE%20does%20not%20work.%3C%2FP%3E%3CP%3EAny%20pointers%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20a%20lot.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-233609%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Graph%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234159%22%20slang%3D%22en-US%22%3ERe%3A%20Delete%20a%20site%20collection%20via%20Microsoft%20Graph%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234159%22%20slang%3D%22en-US%22%3E%3CP%3EWell%2C%20there's%20no%20real%20use%20case%20scenario%20in%20a%20productive%20environment%20for%20this.%20I%20was%20just%20exploring%20and%20curious%20and%20a%20little%20confused%20that%20the%20Microsoft%20Graph%20would%20not%20support%20DELETE%20for%20site%20collections.%3C%2FP%3E%3CP%3EBack%20to%20PNP%20PowerShell%20then.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-233836%22%20slang%3D%22en-US%22%3ERe%3A%20Delete%20a%20site%20collection%20via%20Microsoft%20Graph%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-233836%22%20slang%3D%22en-US%22%3EMight%20I%20ask%20why%20you%20want%20to%20use%20the%20Graph%20for%20deleting%20a%20Site%20Collection%3F%20As%20you%20surely%20know%2C%20there%20is%20currently%20no%20parity%20between%20what%20you%20can%20do%20with%20the%20Graph%20and%20what%20you%20can%20do%20with%20CSOM%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2393898%22%20slang%3D%22en-US%22%3ERe%3A%20Delete%20a%20site%20collection%20via%20Microsoft%20Graph%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2393898%22%20slang%3D%22en-US%22%3E%3CP%3EI%20know%20this%20is%20an%20old%20thread%20but%20would%20like%20to%20mention%2C%20for%20wanderers%20like%20me%2C%20that%20deleting%20files%20via%20Graph%20its%20possible%3A%26nbsp%3B%3CA%20title%3D%22Eliminar%20un%20recurso%20DriveItem%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fes-es%2Fgraph%2Fapi%2Fdriveitem-delete%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEliminar%20un%20recurso%20DriveItem%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20how%20the%20Drives%20API%20works%20-%20every%20user%20has%20access%20to%20multiple%20drives.%20The%20OneDrive%20for%20Business%20is%20just%20one%20of%20the%20drives.%20Every%20SharePoint%20document%20library%20is%20also%20a%20drive.%3C%2FP%3E%3CP%3EIn%20general%2C%20drives%20are%20accessed%20as%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%2Fdrives%2F%3CDRIVE-ID%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20the%20second%20example%20on%20the%20reference%20page%20shows%20-%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fdrive_get%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fdrive_get%3C%2FA%3E.%3C%2FDRIVE-ID%3E%3C%2FP%3E%3CP%3EThe%20OneDrive%20for%20Business%20can%20be%20accessed%20as%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%2Fme%2Fdrive%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20a%20convenience%20shortcut.%3C%2FP%3E%3CP%3ESimply%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%2Fdrive%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Epoints%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EShared%20Documents%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edocument%20library%20from%20the%20root%20site%20collection.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20some%20of%20this%20helps%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular Contributor

Hi,

I'm taking my first baby steps with the Microsoft Graph and I was wondering how to perform a task such as deleting a classic team site. I know how to GET it as described in the official API reference. However, for SharePoint it only seems to mentions GET requests and DELETE does not work.

Any pointers?

 

Thanks a lot.

3 Replies
Might I ask why you want to use the Graph for deleting a Site Collection? As you surely know, there is currently no parity between what you can do with the Graph and what you can do with CSOM

Well, there's no real use case scenario in a productive environment for this. I was just exploring and curious and a little confused that the Microsoft Graph would not support DELETE for site collections.

Back to PNP PowerShell then. Thanks.

I know this is an old thread but would like to mention, for wanderers like me, that deleting files via Graph its possible: Eliminar un recurso DriveItem 

 

Here's how the Drives API works - every user has access to multiple drives. The OneDrive for Business is just one of the drives. Every SharePoint document library is also a drive.

In general, drives are accessed as /drives/<drive-id> as the second example on the reference page shows - https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/drive_get.

The OneDrive for Business can be accessed as /me/drive as a convenience shortcut.

Simply /drive points to the Shared Documents document library from the root site collection. 

Hope some of this helps