Skip to content

"spo page remove" - there is no way to delete a page when it's in the "lock" state. #6294

@paul-gladoon

Description

@paul-gladoon

Priority

(Urgent) I can't use the CLI

Description

There is no way to delete a page when it's in the "lock" state. Here is the error message:

The file ${pageName}.aspx is locked for shared use by ${tenant} [membership]

Steps to reproduce

You have created a new modern page, switched to edit mode, and then closed the browser window. As a result, the edit mode remains active. Now, try executing the CLI command "spo page remove".

Expected results

The page should be removed, regardless of it's state.

Actual results

The error message:
The file ${pageName}.aspx is locked for shared use by ${tenant} [membership]

Diagnostics

`./node_modules/.bin/m365 spo page remove --name power.aspx --webUrl https://automationshortpoint.sharepoint.com/sites/elements_layout --debug
Executing command spo page remove with options {"options":{"name":"power.aspx","webUrl":"https://automationshortpoint.sharepoint.com/sites/elements_layout","debug":true,"output":"text"}}
Executing command as '[email protected]', appId: xxxxxx, tenantId: xxxxx
? Are you sure you want to remove the page 'power.aspx'? yes

Existing access token still valid. Returning...
Request:
{
"url": "https://automationshortpoint.sharepoint.com/sites/elements_layout/_api/contextinfo",
"method": "post",
"headers": {
"Accept": "application/json;odata=nometadata",
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/8.0.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:8.0.0",
"authorization": "Bearer "
},
"responseType": "json",
"decompress": true
}
Response:
{
"url": "https://automationshortpoint.sharepoint.com/sites/elements_layout/_api/contextinfo",
"status": 200,
"statusText": "OK",
"headers": {
"cache-control": "private, max-age=0",
"transfer-encoding": "chunked",
"content-type": "application/json;odata=nometadata;streaming=true;charset=utf-8",
"expires": "Sun, 18 Aug 2024 08:32:22 GMT",
"last-modified": "Mon, 02 Sep 2024 08:32:22 GMT",
"vary": "Origin,Accept-Encoding",
"p3p": "CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"",
"x-networkstatistics": "0,525568,0,0,672380,0,164441,22",
"x-sharepointhealthscore": "3",
"x-sp-serverstate": "ReadOnly=0",
"dataserviceversion": "3.0",
"spclientservicerequestduration": "16",
"sprequestduration": "17",
"x-aspnet-version": "4.0.30319",
"x-databoundary": "EU",
"x-1dscollectorurl": "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/",
"x-ariacollectorurl": "https://eu-mobile.events.data.microsoft.com/Collector/3.0",
"sprequestguid": "9f404ca1-c008-9000-cd49-6af687dcb1ca",
"request-id": "9f404ca1-c008-9000-cd49-6af687dcb1ca",
"ms-cv": "oUxAnwjAAJDNSWr2h9yxyg.0",
"strict-transport-security": "max-age=31536000",
"x-frame-options": "SAMEORIGIN",
"content-security-policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com app.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;",
"x-powered-by": "ASP.NET",
"microsoftsharepointteamservices": "16.0.0.25214",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"x-cache": "CONFIG_NOCACHE",
"x-msedge-ref": "Ref A: DCE4782ECE61480AA4D4C448D88C5A55 Ref B: BUD01EDGE0309 Ref C: 2024-09-02T08:32:22Z",
"date": "Mon, 02 Sep 2024 08:32:22 GMT"
},
"data": {
"FormDigestTimeoutSeconds": 1800,
"FormDigestValue": "0x700378B541CA806E86B9145869AB04C79BEEE2336FCEE5DA6E0ACDEDEBB3D748DC504C6940D0DDF59B4E2CF6D46989FFAD9D082E32BFD1F45885A2AD9628C39E,02 Sep 2024 08:32:22 -0000",
"LibraryVersion": "16.0.25214.12003",
"SiteFullUrl": "https://automationshortpoint.sharepoint.com/sites/elements_layout",
"SupportedSchemaVersions": [
"14.0.0.0",
"15.0.0.0"
],
"WebFullUrl": "https://automationshortpoint.sharepoint.com/sites/elements_layout"
}
}
Removing page power.aspx...
Existing access token still valid. Returning...
Request:
{
"url": "https://automationshortpoint.sharepoint.com/sites/elements_layout/_api/web/GetFileByServerRelativePath(DecodedUrl='/sites/elements_layout/sitepages/power.aspx')",
"method": "post",
"headers": {
"Accept": "application/json;odata=nometadata",
"Content-Type": "application/json;odata=nometadata",
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/8.0.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:8.0.0",
"X-RequestDigest": "0x700378B541CA806E86B9145869AB04C79BEEE2336FCEE5DA6E0ACDEDEBB3D748DC504C6940D0DDF59B4E2CF6D46989FFAD9D082E32BFD1F45885A2AD9628C39E,02 Sep 2024 08:32:22 -0000",
"X-HTTP-Method": "DELETE",
"authorization": "Bearer "
},
"responseType": "json",
"decompress": true
}
Request error:
{
"url": "https://automationshortpoint.sharepoint.com/sites/elements_layout/_api/web/GetFileByServerRelativePath(DecodedUrl='/sites/elements_layout/sitepages/power.aspx')",
"status": 423,
"statusText": "Locked",
"headers": {
"cache-control": "private, max-age=0",
"transfer-encoding": "chunked",
"content-type": "application/json;odata=nometadata;streaming=true;charset=utf-8",
"expires": "Sun, 18 Aug 2024 08:32:22 GMT",
"last-modified": "Mon, 02 Sep 2024 08:32:22 GMT",
"vary": "Origin",
"p3p": "CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"",
"x-networkstatistics": "0,525568,0,0,2221,0,30350,22",
"x-sharepointhealthscore": "0",
"x-sp-serverstate": "ReadOnly=0",
"dataserviceversion": "3.0",
"spclientservicerequestduration": "111",
"sprequestduration": "112",
"x-aspnet-version": "4.0.30319",
"x-databoundary": "EU",
"x-1dscollectorurl": "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/",
"x-ariacollectorurl": "https://eu-mobile.events.data.microsoft.com/Collector/3.0",
"sprequestguid": "9f404ca1-e00e-9000-cd49-6098ed33e794",
"request-id": "9f404ca1-e00e-9000-cd49-6098ed33e794",
"ms-cv": "oUxAnw7gAJDNSWCY7TPnlA.0",
"strict-transport-security": "max-age=31536000",
"x-frame-options": "SAMEORIGIN",
"content-security-policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com app.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;",
"x-powered-by": "ASP.NET",
"microsoftsharepointteamservices": "16.0.0.25214",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"x-cache": "CONFIG_NOCACHE",
"x-msedge-ref": "Ref A: 02454D3862E045AAA7EE0247D888DF00 Ref B: BUD01EDGE0309 Ref C: 2024-09-02T08:32:22Z",
"date": "Mon, 02 Sep 2024 08:32:22 GMT"
},
"error": {
"odata.error": {
"code": "-2147018894, Microsoft.SharePoint.SPFileLockException",
"message": {
"lang": "en-US",
"value": "The file https://automationshortpoint.sharepoint.com/sites/elements_layout/sitepages/power.aspx is locked for shared use by [email protected] [membership]."
}
}
}
}

Timings:
api: 445.714607ms
core: 12.907832ms
command: 13643.454581ms
options: 0.230371ms
total: 13657.750833ms
validation: 0.495084ms
Error: The file https://automationshortpoint.sharepoint.com/sites/elements_layout/sitepages/power.aspx is locked for shared use by [email protected] [membership].`

CLI for Microsoft 365 version

8.0.0

nodejs version

v20.12.2

Operating system (environment)

macOS

Shell

bash

cli doctor

authMode : Browser
cliAadAppId : xxxxxxxxxx
cliAadAppTenant: common
cliConfig : {"autoOpenLinksInBrowser":true,"copyDeviceCodeToClipboard":true,"output":"text","printErrorsAsPlainText":true,"prompt":true,"showHelpOnFailure":true,"showSpinner":true,"helpMode":"full","authType":"browser","clientId":"xxxxxxxx","tenantId":"xxxxxxxxx"}
cliEnvironment :
cliVersion : 8.0.0
nodeVersion : v20.12.2
os : {"platform":"darwin","version":"Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64","release":"23.5.0"}
roles : []
scopes : {"https://graph.microsoft.com":["AllSites.FullControl","AppCatalog.ReadWrite.All","AuditLog.Read.All","Bookings.Read.All","ChannelMember.ReadWrite.All","ChannelMessage.Read.All","ChannelMessage.Send","ChannelSettings.ReadWrite.All","Chat.Read","Chat.ReadWrite","Directory.AccessAsUser.All","Directory.ReadWrite.All","ExternalConnection.ReadWrite.All","Group.ReadWrite.All","IdentityProvider.ReadWrite.All","Mail.Read.Shared","Mail.ReadWrite","Mail.Send","Notes.Read.All","Place.Read.All","Policy.Read.All","RecordsManagement.ReadWrite.All","Reports.Read.All","SecurityEvents.Read.All","ServiceHealth.Read.All","ServiceMessage.Read.All","ServiceMessageViewpoint.Write","Tasks.ReadWrite","Team.Create","TeamMember.ReadWrite.All","TeamsAppInstallation.ReadWriteForUser","TeamSettings.ReadWrite.All","TeamsTab.ReadWrite.All","TermStore.ReadWrite.All","User.Invite.All","User.ReadWrite.All","profile","openid","email"],"https://automationshortpoint.sharepoint.com":["AllSites.FullControl","AppCatalog.ReadWrite.All","AuditLog.Read.All","Bookings.Read.All","ChannelMember.ReadWrite.All","ChannelMessage.Read.All","ChannelMessage.Send","ChannelSettings.ReadWrite.All","Chat.Read","Chat.ReadWrite","Directory.AccessAsUser.All","Directory.ReadWrite.All","ExternalConnection.ReadWrite.All","Group.ReadWrite.All","IdentityProvider.ReadWrite.All","Mail.Read.Shared","Mail.ReadWrite","Mail.Send","Notes.Read.All","Place.Read.All","Policy.Read.All","RecordsManagement.ReadWrite.All","Reports.Read.All","SecurityEvents.Read.All","ServiceHealth.Read.All","ServiceMessage.Read.All","ServiceMessageViewpoint.Write","Tasks.ReadWrite","Team.Create","TeamMember.ReadWrite.All","TeamsAppInstallation.ReadWriteForUser","TeamSettings.ReadWrite.All","TeamsTab.ReadWrite.All","TermStore.ReadWrite.All","User.Invite.All","User.ReadWrite.All"]}

Additional Info

I think you should add a new flag to remove "locked" pages.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions