Friday, March 25, 2016

SharePoint PowerShell CSOM send email

In my previous article I explained about reading a SharePoint list using SharePoint PowerShell CSOM. In this article I will simply explain how to send an email using SharePoint PowerShell CSOM. 

In order to do this, you need to have the PowerShell CSOM setup done as I have explained in my previous article

An email can be simply sent using the SendMail method of the Utility class through the following code.

$email = [String[]]($email_receiver)
$emailProperties = New-Object Microsoft.SharePoint.Client.Utilities.EmailProperties
$emailProperties.To = $email
$emailProperties.Subject = $email_subject
$emailProperties.Body = $Body
[Microsoft.SharePoint.Client.Utilities.Utility]::SendEmail($Context,$emailProperties)


Used variables along with the description are as follows.

  • $email_receiver - Received email address. This needs to be an email of a user within the organization as we are using the SendEmail method.
  • $email_subject - Subject of the email.
  • $Body - Body of the email.
  • $email - This needs to be an array contains at least one element.


6 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Much obliged, that was a truly cool read! hotmail com login

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. hotmail email login

    ReplyDelete
  5. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. hotmail email login

    ReplyDelete
  6. So, if they like your products or services then maybe they contact you or they share their email to you. You should start playing around LinkedIn.Email List for Marketing

    ReplyDelete