{"id":13857369,"url":"https://github.com/Azure/Microsoft365R","last_synced_at":"2025-07-13T21:32:26.613Z","repository":{"id":37686458,"uuid":"328714583","full_name":"Azure/Microsoft365R","owner":"Azure","description":"R SDK for interacting with Microsoft 365 APIs","archived":false,"fork":false,"pushed_at":"2024-08-20T16:57:24.000Z","size":495,"stargazers_count":318,"open_issues_count":38,"forks_count":46,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-20T23:27:26.718Z","etag":null,"topics":["azure-sdk-r","microsoft-365","microsoft-graph-api","office-365","onedrive","onedrive-for-business","r","sharepoint-online"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-11T15:51:43.000Z","updated_at":"2024-11-14T16:41:04.000Z","dependencies_parsed_at":"2024-02-22T05:25:57.308Z","dependency_job_id":"aa30aca4-a4aa-45e3-9e7b-e8e1015c3e3a","html_url":"https://github.com/Azure/Microsoft365R","commit_stats":{"total_commits":167,"total_committers":7,"mean_commits":"23.857142857142858","dds":0.2455089820359282,"last_synced_commit":"299718f0457d1ee255ea693eb262a86b60013ecc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2FMicrosoft365R","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2FMicrosoft365R/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2FMicrosoft365R/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2FMicrosoft365R/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azure","download_url":"https://codeload.github.com/Azure/Microsoft365R/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225920290,"owners_count":17545463,"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":["azure-sdk-r","microsoft-365","microsoft-graph-api","office-365","onedrive","onedrive-for-business","r","sharepoint-online"],"created_at":"2024-08-05T03:01:34.707Z","updated_at":"2024-11-22T15:30:33.536Z","avatar_url":"https://github.com/Azure.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# Microsoft365R \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=150 /\u003e\n\n[![CRAN](https://www.r-pkg.org/badges/version/Microsoft365R)](https://cran.r-project.org/package=Microsoft365R)\n![Downloads](https://cranlogs.r-pkg.org/badges/Microsoft365R)\n![R-CMD-check](https://github.com/Azure/Microsoft365R/workflows/R-CMD-check/badge.svg)\n\nMicrosoft365R is intended to be a simple yet powerful R interface to [Microsoft 365](https://www.microsoft.com/en-us/microsoft-365) (formerly known as Office 365), leveraging the facilities provided by the [AzureGraph](https://cran.r-project.org/package=AzureGraph) package. Currently it supports Microsoft Teams, Outlook, SharePoint Online, and OneDrive.\n\nThe primary repo for this package is at https://github.com/Azure/Microsoft365R; please submit issues and PRs there. It is also mirrored at the Cloudyr org at https://github.com/cloudyr/Microsoft365R. You can install the development version of the package with `devtools::install_github(\"Azure/Microsoft365R\")`.\n\n## Authentication\n\nThe first time you call one of the Microsoft365R functions (see below), it will use your Internet browser to authenticate with Azure Active Directory, in a similar manner to other web apps. See [app_registration.md](https://github.com/Azure/Microsoft365R/blob/master/inst/app_registration.md) for more details on the app registration and permissions requested. The \"Authentication\" vignette describes the authentication process in greater depth, including optional arguments and troubleshooting common problems. \n\n## Client functions\n\nMicrosoft365R defines a number of top-level client functions to access the individual Microsoft 365 services. Below are some simple code examples that show how to use the package. For more information, see the vignettes for the individual services.\n\n### OneDrive\n\nTo access your personal OneDrive call `get_personal_onedrive()`, and to access OneDrive for Business, call `get_business_onedrive()`. These return an R6 client object of class `ms_drive`, which has methods for working with files and folders. `\n\n```r\nod \u003c- get_personal_onedrive()\nodb \u003c- get_business_onedrive()\n\n# list files and folders\nod$list_items()\nod$list_items(\"Documents\")\n\n# upload and download files\nod$upload_file(\"somedata.xlsx\")\nod$download_file(\"Documents/myfile.docx\")\n\n# create a folder\nod$create_folder(\"Documents/newfolder\")\n\n# open a document for editing in Word Online\nod$open_item(\"Documents/myfile.docx\")\n\n# working with data frames and R objects\nod$save_dataframe(iris, \"Documents/iris.csv\")\niris2 \u003c- od$load_dataframe(\"Documents/iris.csv\")\n\nwtmod \u003c- lm(wt ~ ., data=mtcars)\nod$save_rds(wtmod, \"Documents/wtmod.rds\")\nwtmod2 \u003c- od$load_rds(\"Documents/wtmod.rds\")\n```\n\n### SharePoint Online\n\nTo access a SharePoint site, use the `get_sharepoint_site()` function and provide the site name, URL or ID. You can also list the sites you're following with `list_sharepoint_sites()`.\n\n```r\nlist_sharepoint_sites()\nsite \u003c- get_sharepoint_site(\"My site\")\n\n# document libraries\nsite$list_drives()\n\n# default document library\ndrv \u003c- site$get_drive()\n\n# a drive has the same methods as for OneDrive above\ndrv$list_items()\ndrv$open_item(\"teamproject/plan.xlsx\")\n\n# lists\nsite$get_lists()\n\nlst \u003c- site$get_list(\"my-list\")\n\n# return the items in the list as a data frame\nlst$list_items()\n```\n\n### Teams\n\nTo access a team in Microsoft Teams, use the `get_team()` function and provide the team name or ID. You can also list the teams you're in with `list_teams()`. These return objects of R6 class `ms_team` which has methods for working with channels; in turn, a channel has methods for working with messages and transferring files.\n\n```r\nlist_teams()\nteam \u003c- get_team(\"My team\")\n\n# associated SharePoint site and drive\nteam$get_drive()\nteam$get_sharepoint_site()\n\n# channels\nteam$list_channels()\n\nchan \u003c- team$get_channel(\"General\")\n\n# messages\nchan$list_messages()\nchan$send_message(\"Hello from R\", attachments=\"hello.md\")\n\nmsg \u003c- chan$get_message(\"msg-id\")\nmsg$send_reply(\"Reply from R\")\n\n# files: similar methods to OneDrive\nchan$list_files()\nchan$download_file(\"myfile.docx\")\n```\n\n### Outlook\n\nMicrosoft365R supports sending, receiving and managing emails in Outlook. Use the `get_personal_outlook()` method to access your emails for your personal account, and `get_business_outlook()` for your work or school account. Emails can optionally be composed using either the blastula or emayili packages.\n\n```r\noutl \u003c- get_personal_outlook()\noutlb \u003c- get_business_outlook()\n\n# compose an email with blastula\nlibrary(blastula)\nbl_body \u003c- \"## Hello!\n\nThis is an email message that was generated by the blastula package.\n\nWe can use **Markdown** formatting with the `md()` function.\n\nCheers,\n\nThe blastula team\"\n\nbl_em \u003c- compose_email(\n    body=md(bl_body),\n    footer=md(\"sent via Microsoft365R\")\n)\nem \u003c- outl$create_email(bl_em, subject=\"Hello from R\", to=\"bob@example.com\")\n\n# add an attachment and send it\nem$add_attachment(\"mydocument.docx\")\nem$send()\n\n# list the most recent emails in your inbox\nemlst \u003c- outl$list_emails()\n\n# reply to the most recent email\nemlst[[1]]$\n    create_reply(\"Replying from R\")$\n    send()\n```\n\n----\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/Azure/AzureR\"\u003e\u003cimg src=\"https://github.com/Azure/AzureR/raw/master/images/logo2.png\" width=800 /\u003e\u003c/a\u003e\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure%2FMicrosoft365R","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAzure%2FMicrosoft365R","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure%2FMicrosoft365R/lists"}