Showing posts with label Office 365. Show all posts
Showing posts with label Office 365. Show all posts

Monday, 11 November 2019

Send an email to distribution groups in Microsoft Flow

In this article, I will be demonstrating how to send an email to Distribution List/Group in MS flow.
It’s been a very common ask from end-users that can we send email from DL using MS flow. What I found sending out email using flow creating bit confusion when we talk about sending notification, email or announcing from MS flow.
Recently, I observed that we got many requests enquiring on email set up to automate your work. As we all know MS flow is replacing SharePoint Designer gradually and it is expected from this product to work like SPD. I got a request where users wanted to send an email via Flow to all the members of a given SharePoint Security Group.
First of all, I would like to summaries you about Office 365 groups vs distribution lists
In simple word, we can explain the difference between Office 365 groups and distribution lists that Office 365 groups are distribution lists plus more/advance features from the distribution group.
Distribution list: This Enables users to send emails to all members of a group with some limitation like it can not be shared, access type is not available, Document library is missing as it’s was coming from the exchange, and last but important can not be restored once deleted.
Where in Office 365 Group, All the features of DL is available plus it has other enhanced feature while DL does not have. The most important reason to use Office 365 groups is enhancing collaboration. While distribution lists have the same purpose, Office 365 Groups go a few steps further.
Hope, we are clear with Distribution list and Office 365 group. As we all in-migration stage from On-premises to online. Local DL allow us to convert to Office365 group without data loss or hampering end users.
Let’s start with How to send an email to distribution list/Group in MS flow. Following below steps by steps with screenshots will achieve the same.
· Login to MS flow and create new instant from blank.
 
· As soon as you are selecting the above highlighted, you will get an intro page of MS flow, you can select options from given and decide the name of WF. Also, you can click on skip and change name later
· In my case, skip the intro and selected Sharepoint on down the page, see the below images and details
         - Select SharePoint, therefore select item created or modified under action by targeting SP sites and List.
         - Once done, click on new actions and select office 365 outlook and select send an email (v2)
 
 
· Now, it will prompt to update the required filed like to address, subject, body and other details which are available in advanced option (attachment and other references)
· In to address, copy your DL email address, under subject field you can define what message you wanted to pass for end-users
· Under body form, you can pass simple or advance message for end-user. There are options available under MS flow actions or can be used for simple HTML page.
 
 
· Later making all the changes, click on the save option.
· Now, create any one item or modified the existing item which you targeted in the SharePoint option.
· While creating items, you can just pass the required detail and click on create.
Note: this action needs to be done on a SharePoint list, hence kindly browse through the site for testing. Also, the flow will be an application to all the users who do have access to modify or create an item to the SPO list.
We can see that emails are getting triggered to all the users who all are the members of the mentioned DL.
Open the outlook for anyone users who is a member of this DL and can be verified that this action is working as expected. See below email for more details.
 
 
In this article, we experienced about, how to send email from DL in SharePoint using MS flow. Following the same steps, we can perform for Office 365 Groups as well. No changes required.

Tuesday, 23 January 2018

SharePoint Online Automation: Increase SharePoint Storage Quota in SharePoint Online Using PowerShell

In this article, we will learn about How to Increase SharePoint Storage Quota in SharePoint Online Using PowerShell. In last few of articles I have been demonstrated about below topics:

Kindly check the above articles to understand the requirement of business and solve the issue programmatically.
This demonstration will be applied to SharePoint Online, Office 365 Admin, and Office 365 Small Business Admin
As we know When a site collection is created in SharePoint online, we must specify a storage quota. This site size value must be between 100 MB and 100 GB. We will discuss more about site collection quota and usage in next coming article.
SharePoint online Site Collection Quota is allocated a quantity of storage that's based on your number of users. The storage is available to all site collections in the tenant and serves as a central pool from which everyone can draw. Site quota can be updated and modify as per requirement. If you are a Global admin for Office 365 tenant or Site collection administrator you will have access to do it.
Example: If you are managing a site collection, it will be easy to check site quota and increase the same, if working in the organization as SharePoint online Administrator where more than 1000+ site collection exists and on daily basis, we keep getting the request to update site collection quota. This is something where we need more attention and human effort to work on the same request.
Below are the steps to perform the above activity step by step with the screenshot:
Open PowerShell ISE with Admin rights and copy below script
As mentioned in last articles, we always need to do changes to the defined variable as per your requirement. Here we need to update below details,

  • $UserName = User Name of your Office 365 account – Line 7
  • $Password = Your Account password – Line 8
  • $Site URL - Site URL of Office 365 SharePoint Online where you increase site quota – Line 17
  • Read-Host "Enter the SharePoint Online Tenant" – Line 3
  • Tenant URL
  • $Quota=Read-Host "Enter the Storage Quota (1 GB) to be increased [in GB]: - Line 18

See below screenshot for more details

Import-Module Microsoft.Online.SharePoint.Powershell
Write-Host "This script is to set Storage Quota" -f DarkGreen
Read-Host "Enter the SharePoint Online Tenant"
   
   Write-Host "Connecting to SharePoint Online Tenant"
   
   $UserName="Your Account Name"  
   $Password ='Password'
   #Setup Credentials to connect
   $Credentials = New-Object System.Management.Automation.PSCredential($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))  
 
   Connect-SPOService -Url "Office 365 Tenant" -Credential $Credentials
   Write-Host "Your Tenant is connected"
   $SiteUrl=Read-Host "Enter the site Collection URL to which you want to increase storage quota"
   [int]$Quota=Read-Host "Enter the Storage Quota (1 GB)to be increased [in GB]:"
   $siteUrlDetail= Get-SPOSite $SiteUrl -Detailed -Limit all
   [int]$CurrentStorage= $siteUrlDetail.StorageQuota
       if ($Quota -eq 5)
       {
       Write-Host "Current Storage Quota is: $([MATH]::Round($CurrentStorage/1024,2)) GB"
       [int]$NewStorage = $Quota * 1024
       $StorageToIncrease = $CurrentStorage + $NewStorage
       Set-SPOSite -Identity $SiteUrl -StorageQuota $StorageToIncrease
       $NewSite = Get-SPOSite $SiteUrl -Detailed
       $NewQuota = [MATH]::Round($NewSite.StorageQuota/1024,2)
       Write-Host "New Storage Quota is : $NewQuota GB"
       }
       else
       {
           Write-Host "You have entered the wrong value.As per Defined policy, Please enter 1 GB only for Sites" -f Red
       }
  
  • Once you have done with changes or modification of defined variables, click on F5 and wait for below screen to come up asking you to enter Office 365 URL, see below screenshot:


  • After the site is getting connected, it will prompt for Site collection where you want to increase site Quota.



  • Later this entry, PowerShell script will start action to check existing site quota and it will match with defined standard quota if Site quota is exceeded than standard limitation it will prompt to enter the site quota. 
  • Now you can see, you site quota has been changed and it will show the current quota size of site collection as well.

SharePoint Online Automation: O365 SharePoint Online- How to Upload your files remotely using PowerShell to SPO document Library.

SharePoint Online Automation: O365 SharePoint Online- How to Upload your files remotely using PowerShell to SPO document Library.
Continue, with SharePoint Online Automation Today going to demonstrate about “O365 SharePoint Online- How to Upload your files remotely using PowerShell to SPO document Library”.
In My last below articles, I have described you about below mentioned:


In this article, we will learn about O365 SharePoint Online- How to Upload your files remotely using PowerShell to SPO document Library. It’s very common query and requirement with Admins to Upload the files which are placed in the local system to SharePoint sites to avoid manual tasks, Risks, and hassle-free process.


Let us start live example step by step with screenshots:


  • Open PowerShell ISE with Admin rights and copy below script




As mentioned in last articles, we always need to do changes of the defined variable as per your requirement. Here we need to update the below details:
  • $User = User Name of your Office 365 account
  • $Password = Your Account password
  • $Site URL: Site URL of Office 365 SharePoint Online where you want to copy or move document
  • $Folder: Destination location from here it will copy your files and copy to destination URL
  • $DocLibName: Document Library name where you want to Copy the Files which will take from Local system


#Specify tenant admin and site URL
$User = "Your id"
$Password = 'Your Password'
$SiteURL = "Site URL/"
$Folder = "C:\Script\HpeQuota" #Path where you want to Copy
$DocLibName = "Documents" #Docs library
#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,(ConvertTo-SecureString $Password -AsPlainText -Force))
$Context.Credentials = $Creds
#Retrieve list
$List = $Context.Web.Lists.GetByTitle($DocLibName)
$Context.Load($List)
$Context.ExecuteQuery()
#Upload file
Foreach ($File in (dir $Folder -File))
{
$FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
$FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInfo.Overwrite = $true
$FileCreationInfo.ContentStream = $FileStream
$FileCreationInfo.URL = $File
$Upload = $List.RootFolder.Files.Add($FileCreationInfo)
$Context.Load($Upload)
$Context.ExecuteQuery()
}
Save the above script once all changes has been done, In above script, you can see I have added Add-Type -path, which will refer reference file of SharePoint Online Management shell.


We need to follow below steps to execute above command without any error:


  • Ensure that SharePoint Client components SDK installed on a user machine if it’s not installed kindly download the same executable file and install to your local system:




  • Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll paths mentioned in the script are same as user’s machine
  • Set the “execution policies” for PowerShell in user machine by executing Remote signed


Set-ExecutionPolicy Remotesigned


Once you have verified all pre-requisites, you are ready to run the script which will upload your files from local system to SharePoint site URL under a document library. Now click on F5 and wait for some time to get upload all files which is copied from local system to SharePoint Online Document Library.