Skip to content

Bug report: m365 spo page set doesn't prompt for options when specifying nothing to update #5938

@MathijsVerbeeck

Description

@MathijsVerbeeck

Priority

(Low) Something is a little off

Description

When using the command m365 spo page set it will prompt for the required options, but not for an optional one, making it possible to run the command without specifying any property to update, so it basically just returns.

I have also noticed that, however the docs mention that the command will not return a response, the XML of the page is being logged when setting layoutType. This is most likely due to that we are calling a separate command to execute this step.

Steps to reproduce

  1. run m365 spo page set

Expected results

Prompting for atleast one property to update

Actual results

It prompts for the required ones and will then return. The code however will actually checkout the page. So it does some actions.

Diagnostics

Executing command spo page set with options {"options":{"debug":true,"output":"json","name":"Home","webUrl":"https://contoso.sharepoint.com"}}
Executing command as 'App', appId: Hidden, tenantId: Hidden
Request:
{
"url": "https://contoso.sharepoint.com/_api/contextinfo",
"method": "post",
"headers": {
"Accept": "application/json;odata=nometadata",
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/7.5.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:7.5.0",
"authorization": "Bearer"
},
"responseType": "json",
"decompress": true
}
Response:
{
"url": "https://contoso.sharepoint.com/_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": "Tue, 12 Mar 2024 14:19:23 GMT",
"last-modified": "Wed, 27 Mar 2024 14:19:23 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,15,350767,0,198476",
"x-sharepointhealthscore": "2",
"x-sp-serverstate": "ReadOnly=0",
"dataserviceversion": "3.0",
"spclientservicerequestduration": "13",
"sprequestduration": "14",
"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": "472719a1-e0e8-8000-624b-7d04332514e4",
"request-id": "472719a1-e0e8-8000-624b-7d04332514e4",
"ms-cv": "oRknR+jgAIBiS30EMyUU5A.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 *.office365.com *.powerapps.com *.yammer.com engage.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.24706",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"x-cache": "CONFIG_NOCACHE",
"x-msedge-ref": "Ref A: 264F4D5D3F3941AB86534FAB17847C6B Ref B: AMS04EDGE1713 Ref C: 2024-03-27T14:19:23Z",
"date": "Wed, 27 Mar 2024 14:19:22 GMT",
"connection": "close"
},
"data": {
"FormDigestTimeoutSeconds": 1800,
"FormDigestValue": "",
"LibraryVersion": "16.0.24706.12008",
"SiteFullUrl": "https://contoso.sharepoint.com",
"SupportedSchemaVersions": [
"14.0.0.0",
"15.0.0.0"
],
"WebFullUrl": "https://contoso.sharepoint.com"
}
}
"Checking out Home page..."
Existing access token
Request:
{
"url": "https://contoso.sharepoint.com/_api/sitepages/pages/GetByUrl('sitepages/Home.aspx')/checkoutpage",
"method": "post",
"headers": {
"Accept": "application/json;odata=nometadata",
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/7.5.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:7.5.0",
"authorization": ""
},
"responseType": "json",
"decompress": true
}
Response:
{
"url": "https://contoso.sharepoint.com/_api/sitepages/pages/GetByUrl('sitepages/Home.aspx')/checkoutpage",
"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": "Tue, 12 Mar 2024 14:19:23 GMT",
"last-modified": "Wed, 27 Mar 2024 14:19:23 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,92,808459,0,525568",
"x-sharepointhealthscore": "1",
"x-sp-serverstate": "ReadOnly=0",
"dataserviceversion": "3.0",
"spclientservicerequestduration": "152",
"sprequestduration": "153",
"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": "472719a1-f0f0-8000-75bf-459f210e40da",
"request-id": "472719a1-f0f0-8000-75bf-459f210e40da",
"ms-cv": "oRknR/DwAIB1v0WfIQ5A2g.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 *.office365.com *.powerapps.com *.yammer.com engage.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.24706",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"x-cache": "CONFIG_NOCACHE",
"x-msedge-ref": "Ref A: 08E76A7B771345A18A4964E260910991 Ref B: FRA231050416011 Ref C: 2024-03-27T14:19:23Z",
"date": "Wed, 27 Mar 2024 14:19:23 GMT",
"connection": "close"
},
"data": {
"AbsoluteUrl": "https://contoso.sharepoint.com/SitePages/Home.aspx",
"AuthorByline": null,
"BannerImageUrl": "https://contoso.sharepoint.com/_layouts/15/getpreview.ashx?path=%2FSiteAssets%2FSitePages%2FModern-Home%2F148232813-home-header-1-resized_1711531300640.jpg&ow=1228&oh=330",
"BannerThumbnailUrl": "https://contoso.sharepoint.com/_vti_bin/afdcache.ashx/authitem/SiteAssets/SitePages/Modern-Home/148232813-home-header-1-resized_1711531300640.jpg?_oat_=1711578426_90f6b8c7af06902bc1f1f81949747ff8f430860e150823d2615b606fdd5f6e2f&P1=1711553995&P2=1963766474&P3=1&P4=g%2bx6kxHcv7Dcg0jRuy2a0EB%2fu3JCpKbVOIsZK7MQHZ%2b%2b0yenbs%2fE31KtXsQspR4z1%2f84pmny5Q2h%2bn9kGopKQVy%2fyaoF0z7jpVhmZuVf47EnOdLAWKoJ5t47c%2f8fhzAYSpX34moEkocQUBkGcjweRZVx%2b0g%2bvKdCP4sl84sBJnv5KbVLr4XRIOgzBKedD%2bFSuhnLa8fIDOLzycs5xpLcQGDufzDu8Bfr1A9i%2bmHKdgz3lonr2GATueHROFPsLU1DTsFz2iwthMLEJPoq%2fMSnwX%2fai4K6VC3ru633MloMDm5%2f3%2faj%2boFiTLYT8wfQAhCaT5QkeUfpMr1neBtPNeGy2Q%3d%3d&width=400",
"CallToAction": "",
"Categories": null,
"ContentTypeId": "0x0101009D1CB255DA76424F860D91F20E6C411800476D12F05CFD7E4B9FCD03B0B89F53FF",
"Description": null,
"DoesUserHaveEditPermission": true,
"FileName": "Home.aspx",
"FirstPublished": "0001-01-01T08:00:00Z",
"Id": 32,
"IsPageCheckedOutToCurrentUser": true,
"IsWebWelcomePage": true,
"Modified": "2024-03-27T14:13:45Z",
"PageLayoutType": "Home",
"Path": {
"DecodedUrl": "SitePages/Home.aspx"
},
"PromotedState": 0,
"Title": "Home",
"TopicHeader": null,
"UniqueId": "2a0e7f61-10c8-439d-9f18-279686ea687d",
"Url": "SitePages/Home.aspx",
"Version": "11.0",
"VersionInfo": null,
"AlternativeUrlMap": "{"UserPhotoAspx":"https://contoso.sharepoint.com/_vti_bin/afdcache.ashx/_userprofile/userphoto.jpg?_oat_=1711591706_42054882f586e9f979f8c66620cb258fc07bee134036a50a0d20c3d1bd94aa1c&P1=1711552863&P2=1963766474&P3=1&P4=ACNHcQw1K%2bTCyfEHLbpqowolEW2dKPjns9gI8lOeIwiRXygekXaRvAqIp0kNRtfCyWxA5i%2bDltbq0GPAs%2bwShfOrMPubyv0SZruDFfET1l4YCvEl0%2fcSuuifucc4giHLp8Bj65mkHDn%2bEWwizHgsbBMEZZIP98LkTP3JaJOmc6GQ03CGNF18aTAkIhetkVLeKfZgotL%2fPAOM%2f593%2b8cFOFOod94jG6QLvoimFIJLjVY3bPQwT9VZCpRbMBN5ujKBHRuPhhLa4Kepun0ceIl32ak1GVwGuIAjMuZ3qLafMLonfcJPDDJN3ruA2lvC0iTWP2YxE9jp5OKWHEGvSpOYow%3d%3d\",\"MediaTAThumbnailPathUrl\":\"https://northeurope1-mediap.svc.ms/transform/thumbnail?provider=spo&inputFormat={.fileType}&cs=UEFHRVN8U1BP&docid={.spHost}/_api/v2.0/sharePoint:{.resourceUrl}:/driveItem&w={.widthValue}&oauth_token=bearer%20{.oauthToken}\",\"MediaTAThumbnailHostUrl\":\"https://northeurope1-mediap.svc.ms\",\"AFDCDNEnabled\":\"True\",\"CurrentSiteCDNPolicy\":\"True\",\"PublicCDNEnabled\":\"True\",\"PrivateCDNEnabled\":\"True\",\"/SiteAssets/SitePages/Modern-Home/148232813-home-header-1-resized_1711531300640.jpg\":\"https://contoso.sharepoint.com/_vti_bin/afdcache.ashx/authitem/SiteAssets/SitePages/Modern-Home/148232813-home-header-1-resized_1711531300640.jpg?_oat_=1711578426_90f6b8c7af06902bc1f1f81949747ff8f430860e150823d2615b606fdd5f6e2f&P1=1711553995&P2=1963766474&P3=1&P4=g%2bx6kxHcv7Dcg0jRuy2a0EB%2fu3JCpKbVOIsZK7MQHZ%2b%2b0yenbs%2fE31KtXsQspR4z1%2f84pmny5Q2h%2bn9kGopKQVy%2fyaoF0z7jpVhmZuVf47EnOdLAWKoJ5t47c%2f8fhzAYSpX34moEkocQUBkGcjweRZVx%2b0g%2bvKdCP4sl84sBJnv5KbVLr4XRIOgzBKedD%2bFSuhnLa8fIDOLzycs5xpLcQGDufzDu8Bfr1A9i%2bmHKdgz3lonr2GATueHROFPsLU1DTsFz2iwthMLEJPoq%2fMSnwX%2fai4K6VC3ru633MloMDm5%2f3%2faj%2boFiTLYT8wfQAhCaT5QkeUfpMr1neBtPNeGy2Q%3d%3d\"}",
"AuthoringMetadata": null,
"CanvasContent1": "",
"CoAuthState": null,
"Collaborators": null,
"Language": "en-us",
"LayoutWebpartsContent": "[{"id":"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788","instanceId":"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788","title":"Title area","description":"Title Region Description","audiences":[],"serverProcessedContent":{"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}},"dataVersion":"1.4","properties":{"title":"Home","imageSourceType":4,"layoutType":"NoImage","textAlignment":"Left","showTopicHeader":false,"showPublishDate":false,"topicHeader":"","enableGradientEffect":true,"isDecorative":true,"authors":[],"authorByline":[],"hasTitleBeenCommitted":true},"containsDynamicDataSource":false,"reservedHeight":141}]",
"SitePageFlags": ""
}
}
"Page Home is now checked out"
Existing access token
Request:
{
"url": "https://contoso.sharepoint.com/_api/SitePages/Pages(32)/SavePageAsDraft",
"method": "post",
"headers": {
"Accept": "application/json;odata=nometadata",
"Content-Type": "application/json;odata=nometadata",
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/7.5.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:7.5.0",
"authorization": "Bearer"
},
"responseType": "json",
"decompress": true,
"data": {
"Title": "Home",
"BannerImageUrl": "https://contoso.sharepoint.com/_layouts/15/getpreview.ashx?path=%2FSiteAssets%2FSitePages%2FModern-Home%2F148232813-home-header-1-resized_1711531300640.jpg&ow=1228&oh=330",
"CanvasContent1": "",
"LayoutWebpartsContent": "[{"id":"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788","instanceId":"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788","title":"Title area","description":"Title Region Description","audiences":[],"serverProcessedContent":{"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}},"dataVersion":"1.4","properties":{"title":"Home","imageSourceType":4,"layoutType":"NoImage","textAlignment":"Left","showTopicHeader":false,"showPublishDate":false,"topicHeader":"","enableGradientEffect":true,"isDecorative":true,"authors":[],"authorByline":[],"hasTitleBeenCommitted":true},"containsDynamicDataSource":false,"reservedHeight":141}]"
}
}
Response:
{
"url": "https://contoso.sharepoint.com/_api/SitePages/Pages(32)/SavePageAsDraft",
"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": "Tue, 12 Mar 2024 14:19:23 GMT",
"last-modified": "Wed, 27 Mar 2024 14:19:23 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,1227661,0,269774",
"x-sharepointhealthscore": "3",
"x-sp-serverstate": "ReadOnly=0",
"dataserviceversion": "3.0",
"spclientservicerequestduration": "256",
"sprequestduration": "256",
"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": "482719a1-4003-8000-6aa8-358a03ac3ea6",
"request-id": "482719a1-4003-8000-6aa8-358a03ac3ea6",
"ms-cv": "oRknSANAAIBqqDWKA6w+pg.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 *.office365.com *.powerapps.com *.yammer.com engage.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.24706",
"x-content-type-options": "nosniff",
"x-ms-invokeapp": "1; RequireReadOnly",
"x-cache": "CONFIG_NOCACHE",
"x-msedge-ref": "Ref A: 0E32845A3B1841BEB2044DE288727366 Ref B: AMS04EDGE2305 Ref C: 2024-03-27T14:19:23Z",
"date": "Wed, 27 Mar 2024 14:19:23 GMT",
"connection": "close"
},
"data": {
"value": false
}
}

CLI for Microsoft 365 version

v7.5.0

nodejs version

20.11.0

Operating system (environment)

macOS

Shell

zsh

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions