Test project

  1. Connect to M365 services (Automation Runbook):

    • Install the SharePoint Online Management Shell if you haven't already. You can download it from the Microsoft website.

    • Open PowerShell and connect to Microsoft 365 using the following command:

        codeConnect-SPOService -Url https://yourdomain-admin.sharepoint.com
    • You will be prompted to enter your credentials. Once authenticated, you'll be connected to SharePoint Online.

  2. Retrieve Teams Channels:

    • Use the Microsoft Teams PowerShell module to retrieve teams and channels. Install it if you haven't already:

        codeInstall-Module -Name MicrosoftTeams
    • Connect to Microsoft Teams using:

    • Retrieve teams and channels:

        code$teams = Get-Team
        foreach ($team in $teams) {
            $channels = Get-TeamChannel -GroupId $team.GroupId
            foreach ($channel in $channels) {
                if ($channel.DisplayName -eq "carotene") {
                    # Perform actions for carotene channel
  3. Copy Data from Teams to SharePoint:

    • Use SharePoint Online Management Shell commands to interact with SharePoint sites and libraries. For example, to copy files:

        codeCopy-SPOFile -SourceUrl "TeamsURL/Files" -DestinationUrl "SharePointURL/DestinationFolder"
  4. Manage permissions on SharePoint:

    • Use SharePoint Online Management Shell or SharePoint PnP PowerShell to manage permissions. For example, to set permissions:

        codeSet-SPOUser -Site "SiteURL" -LoginName "user@example.com" -IsSiteCollectionAdmin $false
  5. Generate Summary Email:

    • Use PowerShell's built-in Send-MailMessage cmdlet to send emails. For example:

        codeSend-MailMessage -From "sender@example.com" -To "recipient@example.com" -Subject "Summary" -Body "Summary of the process" -SmtpServer "smtp.example.com"
  6. Schedule the Automation:

    • Use Task Scheduler in Windows to schedule the PowerShell script to run every 12 hours.

Remember to replace placeholders like "TeamsURL", "SharePointURL", "", etc., with actual values specific to your environment. Test each step thoroughly before scheduling the automation in a production environment.