pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
929 stars 326 forks source link

New command: m365 pp website webfile list #6262

Open appieschot opened 3 months ago

appieschot commented 3 months ago

Usage

m365 pp website webfile list

Description

List all webfiles for the specified Power Pages website

Options

Option Description
--websiteId [websiteId] ID of the Power Pages website. Specify either websiteId or webName but not both.
--websiteName [websiteName] The unique name (not the display name) of the Power Pages website. Specify either websiteId or webName but not both.
-e, --environmentName <environmentName> The name of the environment where the Power Pages websites are located.
--asAdmin Run the command as admin and retrieve Power Pages websites for environments you do not have explicitly assigned permissions to.

Examples

List all webfiles for the site Contoso

m365 pp website webfile list --websiteName Contoso --environmentName "Default-2ca3eaa5-140f-4175-8261-3272edf9f339"

List all webfiles for the site by id

m365 pp website webfile list --websiteId 2ca3eaa5-140f-4175-8261-3272edf9f339--environmentName "Default-2ca3eaa5-140f-4175-8261-3272edf9f339"

Default properties

Additional Info

More details here: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/mspp_webfile

See our m365 pp card list command on how to implement the as admin, and how to retrieve all items from a given endpoint: https://github.com/pnp/cli-microsoft365/blob/main/src/m365/pp/commands/card/card-list.ts

In this case the API call would be ${dynamicsApiUrl}/api/data/v9.2/mspp_webfiles

appieschot commented 3 months ago

Added an additional default property; the ID of the item helps with later commands (i.e. get commands)

ktskumar commented 2 months ago

May I take this up?

milanholemans commented 2 months ago

Sure, all yours!

ktskumar commented 1 month ago

Api returns the default properties in below names,

Below is the returned response for single object,

{
    "mspp_name": "filename.css",
    "_mspp_websiteid_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "mspp_websiteid",
    "_mspp_websiteid_value@Microsoft.Dynamics.CRM.lookuplogicalname": "mspp_website",
    "_mspp_websiteid_value@OData.Community.Display.V1.FormattedValue": "Website - spddevdocs",
    "_mspp_websiteid_value": "6c0730c5-3c40-4e49-81da-6fbcd018942d",
    "_mspp_parentpageid_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "mspp_parentpageid",
    "_mspp_parentpageid_value@Microsoft.Dynamics.CRM.lookuplogicalname": "mspp_webpage",
    "_mspp_parentpageid_value@OData.Community.Display.V1.FormattedValue": "Home",
    "_mspp_parentpageid_value": "cfca0f6b-ea6f-4f5d-a2b6-de411d67c970",
    "mspp_partialurl": "filename.css",
    "mspp_displaydate": null,
    "_mspp_publishingstateid_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "mspp_publishingstateid",
    "_mspp_publishingstateid_value@Microsoft.Dynamics.CRM.lookuplogicalname": "mspp_publishingstate",
    "_mspp_publishingstateid_value@OData.Community.Display.V1.FormattedValue": "Published",
    "_mspp_publishingstateid_value": "705b586a-ec8b-49a2-805d-ce2ebb91b0ff",
    "mspp_releasedate": null,
    "mspp_expirationdate": null,
    "mspp_cloudblobaddress": null,
    "mspp_contentdisposition@OData.Community.Display.V1.FormattedValue": "inline",
    "mspp_contentdisposition": 756150000,
    "mspp_title": null,
    "mspp_summary": null,
    "mspp_alloworigin": null,
    "mspp_hiddenfromsitemap@OData.Community.Display.V1.FormattedValue": "No",
    "mspp_hiddenfromsitemap": false,
    "mspp_displayorder@OData.Community.Display.V1.FormattedValue": "2",
    "mspp_displayorder": 2,
    "_mspp_masterwebfileid_value": null,
    "mspp_excludefromsearch@OData.Community.Display.V1.FormattedValue": "Yes",
    "mspp_excludefromsearch": true,
    "statecode": 0,
    "mspp_webfileid": "9f39994e-2170-4064-9ae5-fe1676855d79",
    "_mspp_createdby_value@Microsoft.Dynamics.CRM.lookuplogicalname": "systemuser",
    "_mspp_createdby_value@OData.Community.Display.V1.FormattedValue": "Shantha Kumar Thambidurai",
    "_mspp_createdby_value": "5364ffa6-d185-eeff-8179-6045bd002666",
    "_mspp_modifiedby_value@Microsoft.Dynamics.CRM.lookuplogicalname": "systemuser",
    "_mspp_modifiedby_value@OData.Community.Display.V1.FormattedValue": "Shantha Kumar Thambidurai",
    "_mspp_modifiedby_value": "5364ffa6-d185-eeff-8179-6045bd002666",
    "mspp_modifiedon@OData.Community.Display.V1.FormattedValue": "5/16/2024 11:36 AM",
    "mspp_modifiedon": "2024-05-16T06:06:38Z",
    "mspp_createdon@OData.Community.Display.V1.FormattedValue": "5/16/2024 11:36 AM",
    "mspp_createdon": "2024-05-16T06:06:34Z",
    "statuscode@OData.Community.Display.V1.FormattedValue": "Active",
    "statuscode": 1
  }

Do I need to rename / modify the property names after retrieving the result. Please suggest

milanholemans commented 1 month ago

Hi @ktskumar, generally speaking, we never modify the output of the API, so no, just return the result.