Reputation: 75
In the Central Administration of SharePoint 2016, 'Incoming E-Mail Settings' page, I need to set the property for the field 'Active Directory container where new distribution groups and contacts will be created'.
I cannot find using PowerShell the actual property to set the AD container.
Anybody know how I can set it?
Thanks.
#Configure SP incoming mail settings
$svcinstance = Get-SPServiceInstance | ? { $_.TypeName -eq 'Microsoft SharePoint Foundation Incoming E-Mail' }
$incomingMail = $svcinstance.Service
if ($incomingMail -ne $null) {
#Enable sites on this server to receive e-mail
$incomingMail.Enabled = $true
#Automatic Settings mode
$incomingMail.UseAutomaticSettings = $false
#Use the SharePoint Directory Management Service to create distribution groups
$incomingMail.UseDirectoryManagementService = $true
#Accept messages from authenticated users only
$incomingMail.DLsRequireAuthenticatedSenders = $true
#Allow creation of distribution groups from SharePoint sites
$incomingMail.DistributionGroupsEnabled = $true
#SMTP mail server for incoming mail
$incomingMail.ServerAddress = $smtpServerDomainName
#E-mail server display address
$incomingMail.ServerDisplayAddress = $emailDisplayAddress
#E-mail drop folder
$incomingMail.DropFolder = $emailDropFolder
$incomingMail.Update();
}
Upvotes: 0
Views: 113
Reputation: 75
Found out how to achieve this:
#Active Directory container where new distribution groups and contacts will be created
$webApp = Get-SPWebApplication -IncludeCentralAdministration | Where {$_.DisplayName -eq "SharePoint Central Administration v4"}
$site = $webApp.Sites[0]
$web = $site.RootWeb
if($web.AllProperties['EmailWebService_ADContainer']){
$web.AllProperties.Remove('EmailWebService_ADContainer');
$web.Properties['EmailWebService_ADContainer'] = $null;
$web.Update();
$web.Properties.Update();
}
$web.AllProperties.Add('EmailWebService_ADContainer',$activeDirectoryOU)
$web.Update()
$web.Dispose();
$site.Dispose();
Reference: https://www.reddit.com/r/sharepoint/comments/cr85mn/how_to_set_incoming_email_active_directory_for/
Upvotes: 1