{"id":19607552,"url":"https://github.com/andreax79/python-sharepoint-cli","last_synced_at":"2025-04-27T20:32:25.840Z","repository":{"id":52066337,"uuid":"283552448","full_name":"andreax79/python-sharepoint-cli","owner":"andreax79","description":"Command line interface for SharePoint","archived":false,"fork":false,"pushed_at":"2023-02-07T15:07:54.000Z","size":42,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T18:02:52.753Z","etag":null,"topics":["office365","python","sharepoint"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreax79.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-29T16:45:44.000Z","updated_at":"2024-12-23T10:05:22.000Z","dependencies_parsed_at":"2024-11-11T10:11:31.975Z","dependency_job_id":"75b76ca7-29d7-49c3-a68b-308cf1681e3f","html_url":"https://github.com/andreax79/python-sharepoint-cli","commit_stats":{"total_commits":19,"total_committers":3,"mean_commits":6.333333333333333,"dds":"0.26315789473684215","last_synced_commit":"20324ead8deb47d25ec7bf0585b6e4f20f3b056b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreax79%2Fpython-sharepoint-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreax79%2Fpython-sharepoint-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreax79%2Fpython-sharepoint-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreax79%2Fpython-sharepoint-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreax79","download_url":"https://codeload.github.com/andreax79/python-sharepoint-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204548,"owners_count":21552239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["office365","python","sharepoint"],"created_at":"2024-11-11T10:11:20.780Z","updated_at":"2025-04-27T20:32:25.385Z","avatar_url":"https://github.com/andreax79.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Installation\n------------\n\n```console\n$ pip install sharepointcli\n```\n\nConfiguration\n-------------\n\nTo allow authentication you first need to register your application.\nFor steps on how to configure the app in the Azure portal, see [Register your app](https://docs.microsoft.com/en-us/graph/auth-register-app-v2)\n\nFor general use, the `spo configure` command is the fastest way to set up SharePoint CLI.\nWhen you enter this command, the CLI prompts you for the following configurations:\n\n* SharePoint domain\n* Application (client) ID\n* Application (client) secret\n\nThe `spo configure` command stores the credentials in the credentials file.\nYou can configure configure multiple credentials for different SharePoint domains.\nExample:\n\n```console\n$ spo configure\nSharePoint domain (e.g. example.sharepoint.com):\nTenant Id: db3fe96d-1b57-4119-a5fd-bd139021158d\nClient Id: fa3ecc92-5994-475e-a647-1f81931aac43\nClient Secret: ~vaXZkx\u0026836mH56FymE6Gx7j$t\u0026JT.-5em\nVisit the following url to give consent:\nhttps://login.microsoftonline.com/db3fe96d-1b57-4119-a5fd-bd139021158d/oauth2/v2.0/authorize?response_type=...\nPaste the authenticated url here:\nhttps://login.microsoftonline.com/common/oauth2/nativeclient?code=....\nAuthentication Flow Completed. Oauth Access Token Stored. You can now use the API.\nAuthenticated!\n\n```\n\nThe credentials take precedence in the following order:\n\n1. Command line options\n2. Environment variables\n3. Credentials file\n\n#### Command line options\n\nYou can use the following command line options to override the default configuration settings.\n\n* **--client_id \u003cstring\u003e**\n\n  Specifies the Client Id.\n\n* **--client_secret \u003cstring\u003e**\n\n  Specifies the Client Secret\n\n* **--tenant_id \u003cstring\u003e**\n\n  Specifies the Tenant Id\n\n#### Environment variables\n\nEnvironment variables provide another way to specify credentials, and can be\nuseful for scripting.\nIf you specify an option by using a parameter on the command line, it\noverrides any value from the environment variables or the configuration file.\n\nThe CLI supports the following environment variables:\n\n* **SPO_HOME**\n\n  Specifies the home directory.\n  The default path is \"~/.spo\".\n\n* **SPO_CREDENTIALS_FILE**\n\n  Specifies the location of the file that the CLI to store credentials.\n  The default path is \"~/.spo/credentials\".\n\n* **SPO_CLIENT_ID**\n\n  Specifies the Client Id.\n\n* **SPO_CLIENT_SECRET**\n\n  Specifies the Client Secret\n\n* **SPO_TENANT_ID**\n\n  Specifies the Tenant Id\n\n\n#### Credentials file\n\nThe CLI stores sensitive credential information in a file named credentials in a directory named `.spo` in your home directory.\nFor example, the file generated with `spo configure` looks similar to the following:\n\n```ini\n[example.sharepoint.com]\nclient_id = fa3ecc92-5994-475e-a647-1f81931aac43\nclient_secret = ~vaXZkx\u0026836mH56FymE6Gx7j$t\u0026JT.-5em\ntenant_id = db3fe96d-1b57-4119-a5fd-bd139021158d\n```\n\nUsage\n-----\n\n\n### authenticate\n\nPerforms the OAuth authentication flow using the console.\n\n#### Usage\n\n```console\n$ spo authenticate [domain]\n```\n\n\n\n### configure\n\nConfigures credentials.\n\n#### Usage\n\n```console\n$ spo configure [domain]\n```\n\n\n\n### cp\n\nCopying a local file to SharePoint.\n\n#### Usage\n\n```console\n$ spo cp \u003cLocalPath\u003e \u003cSharePointUrl\u003e   or   cp \u003cSharePointUrl\u003e \u003cLocalPath\u003e\n```\n\n#### Examples\n\nThe following cp command copies a single file to a specified site:\n\n```console\n$ spo cp test.txt 'https://example.sharepoint.com/sites/example/Shared documents/test.txt'\nupload: test.txt to https://example.sharepoint.com/sites/example/Shared documents/test.txt\n```\n\nThe following cp command copies a single file from a SharePoint site:\n\n```console\n$ spo cp 'https://example.sharepoint.com/sites/example/Shared documents/test.txt' test.txt\ndownload: https://example.sharepoint.com/sites/example/Shared documents/test.txt' to test.txt\n```\n\n\n\n### help\n\nDisplays commands help.\n\n#### Usage\n\n```console\n$ spo help [topic]\n```\n\n\n\n### ls\n\nLists files and folders.\n\n#### Usage\n\n```console\n$ spo ls [options] \u003cSharePointUrl\u003e\n```\n\n##### Options\n\n-mtime n  File's status was last changed n*24 hours ago. ('+n' more than n, 'n' exactly n, '-n' less than n)\n\n#### Examples\n\n```console\n$ spo ls 'https://example.sharepoint.com/sites/example/Shared documents/*.txt'\n```\n\n\n\n### mkdir\n\nCreates folder.\n\n#### Usage\n\n```console\n$ spo mkdir \u003cSharePointUrl\u003e\n```\n\n\n\n### rm\n\nDeletes files.\n\n#### Usage\n\n```console\n$ spo rm [options] \u003cSharePointUrl\u003e\n```\n\n##### Options\n\n-mtime n  File's status was last changed n*24 hours ago. ('+n' more than n, 'n' exactly n, '-n' less than n)\n\n#### Examples\n\n```console\n$ spo rm 'https://example.sharepoint.com/sites/example/Shared documents/*.txt'\n```\n\n\n\n### rmdir\n\nDeletes folder.\n\n#### Usage\n\n```console\n$ spo rmdir \u003cSharePointUrl\u003e\n```\n\n\n\n### version\n\nPrints the version number.\n\n#### Usage\n\n```console\n$ spo version\n```\n\n\nTests\n-----\n\nTo run the unit tests:\n\n* create the ~/.spo/credentials credentials file\n* export your SharePoint test site url as environment variable 'SITE'\n\n```console\n$ spo configure\nSharePoint domain (e.g. example.sharepoint.com):\nTenant Id: db3fe96d-1b57-4119-a5fd-bd139021158d\nClient Id: fa3ecc92-5994-475e-a647-1f81931aac43\nClient Secret: ~vaXZkx\u0026836mH56FymE6Gx7j$t\u0026JT.-5em\n$ expot SITE='https://example.sharepoint.com/sites/example/Shared documents/test folder'\n$ make test\n```\n\nRegister your app for dummies\n-----------------------------\n\n1. Sign in to the [Azure portal](https://portal.azure.com/).\n1. Select Azure Active Directory.\n1. Under Manage, select App registrations \u003e New registration.\n1. Enter a display name for the authentication and click the Register button.\n1. Copy the Application (client) ID and use it as Client Id for the configuration.\n1. Under Manage, select Authentication \u003e Add a platform.\n1. Select Web as platform.\n1. Set Redirect URI to https://login.microsoftonline.com/common/oauth2/nativeclient\n1. Click on the Configure button to complete the platform configuration.\n1. Select Certificates \u0026 secrets \u003e Client secrets \u003e New client secret.\n1. Add a description.\n1. Select an expiration for the secret (e.g. 24 months).\n1. Click on the Add button.\n1. Copy the secret's value for use in configuration as Client Secret. **The secret value is never displayed again after you leave this page.**\n\n```console\n$ spo configure\nSharePoint domain (e.g. example.sharepoint.com): \u003c-- your SharePoint domain\nTenant Id: db3fe96d-1b57-4119-a5fd-bd139021158d \u003c-- automagical\nClient Id: \u003c\u003c-- copy the Application (client) ID \nClient Secret: \u003c\u003c-- copy Client Secret\nhttps://login.microsoftonline.com/db3fe96d-1b57-4119-a5fd-bd139021158d/v2.0/authorize?response_type=code\u0026client_id=...\n(open the link in your Browser, and authorize the app)\nPaste the authenticated url here:\n(paste the Browser's URL, i.e. https://login.microsoftonline.com/common/oauth2/nativeclient?code=0...)\nAuthentication Flow Completed. Oauth Access Token Stored. You can now use the API.\nAuthenticated!\n```\n\nLicense\n-------\n\nThis project is licensed under the MIT license.\n\nLinks\n-----\n\n* [Project home page (GitHub)](https://github.com/andreax79/python-sharepoint-cli)\n* [O365](https://github.com/O365/python-o365)\n* [SharePlum](https://github.com/jasonrollins/shareplum)\n* [Office 365 CLI](https://github.com/pnp/office365-cli)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreax79%2Fpython-sharepoint-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreax79%2Fpython-sharepoint-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreax79%2Fpython-sharepoint-cli/lists"}