SharePoint 2013 ve Exchange 2013 Yapılandırması – Bölüm 5 – Site Mailbox

Hasan Köroğlu 23 Nisan 2016 0
SharePoint 2013 ve Exchange 2013 Yapılandırması – Bölüm 5 – Site Mailbox

Merhaba Arkadaşlar,

Bu yazımızın konusu SharePoint ve Exchange birlikteliği ile gelen Site Mailbox.

Nedir Bu Site Mailbox?

Site Mailbox, SharePoint portalınız üzerinden erişebildiğiniz merkezi eposta adresi ve doküman paylaşım hesabıdır. Takım arkadaşlarınız Site Mailbox’ı önemli bir eposta oluşturma işleminde veya takım seviyesinde ilgili epostaları toplamak için kullanabilir.

Şimdi bu işlemleri nasıl yapıyoruz beraber bakalım.

Konuya başlamadan SharePoint portalınızın SSL ile çalışıyor olduğundan emin olmanız gerekmektedir.

İlk olarak microsoft’un sitesinden Microsoft Exchange Web Services Managed API 2.0 uygulamasını SharePoint sunucunuza indirin.

exch_conf_106

Daha sonra komut satırını yönetici olarak çalıştırın ve indirdiğiniz uygulamanın bulunduğu dizine geçin.

exch_conf_107

exch_conf_108

Ardından şu komutu çalıştırın.

[code]msiexec /i EwsManagedApi.msi addlocal=”ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac”[/code]

exch_conf_109

Açılan uygulamayı varsayılan değerleri ile kurun.

exch_conf_110

Daha sonra IIS’i iisreset komutu ile yeniden başlatın.

exch_conf_111

Ardından aşağıdaki powershell scriptini Set-SiteMailboxConfig.ps1 ismiyle kaydedin.

[code lang=”powershell”]
# .SYNOPSIS
#
# Set-SiteMailboxConfig helps configure Site Mailboxes for a SharePoint farm
#
# .DESCRIPTION
#
# Establishes trust with an Exchange Server, sets Site Mailbox settings and enables Site Mailboxes for a farm.
#
# .PARAMETER ExchangeSiteMailboxDomain
#
# The FQDN of the Exchange Organization where Site Mailboxes will be created
#
# .PARAMETER ExchangeAutodiscoverDomain
#
# [Optional] The FQDN of an Exchange Autodiscover Virtual Directory
#
# .PARAMETER WebApplicationUrl
#
# [Optional] The URL of a specific web application to configure. If not specified all Web Applications will be configured
#
# .PARAMETER Force
#
# [Optional] Indicate that the script should ignore any configuration issues and enable Site Mailboxes anyway
#

Param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ExchangeSiteMailboxDomain,
[Parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[string]$ExchangeAutodiscoverDomain,
[Parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[string]$WebApplicationUrl,
[Parameter(Mandatory=$false)]
[switch]$Force
)

$script:currentDirectory = Split-Path $MyInvocation.MyCommand.Path

if($WebApplicationUrl -ne $NULL -and $WebApplicationUrl -ne “”)
{
$webapps = Get-SPWebApplication $WebApplicationUrl
}
else
{
$webapps = Get-SPWebApplication
}

if($webapps -eq $NULL)
{
if($WebApplicationUrl -ne $NULL)
{
Write-Warning “No Web Application Found at $($WebApplicationUrl). Please create a web application and re-run Set-SiteMailboxConfig”
}
else
{
Write-Warning “No Web Applications Found. Please create a web application and re-run Set-SiteMailboxConfig”
}

return
}

$rootWeb = $NULL

foreach($webapp in $webapps)
{
if($rootWeb -eq $NULL)
{
$rootWeb = Get-SPWeb $webApp.Url -EA SilentlyContinue
}
}

if($rootWeb -eq $NULL)
{
Write-Warning “Unable to find a root site collection. Please create a root site collection on a web application and re-run Set-SiteMailboxConfig”
return
}

$exchangeServer = $ExchangeAutodiscoverDomain

if($exchangeServer -eq $NULL -or $exchangeServer -eq “”)
{
$exchangeServer = “autodiscover.$($ExchangeSiteMailboxDomain)”
}

Write-Host “Establishing Trust with Exchange Server: $($exchangeServer)”

$metadataEndpoint = “https://$($exchangeServer)/autodiscover/metadata/json/1”

$exchange = Get-SPTrustedSecurityTokenIssuer | Where-Object { $_.MetadataEndpoint -eq $metadataEndpoint }

if($exchange -eq $NULL)
{
$exchange = New-SPTrustedSecurityTokenIssuer -Name $exchangeServer -MetadataEndPoint $metadataEndpoint
}

if($exchange -eq $NULL)
{
Write-Warning “Unable to establish trust with Exchange Server $($exchangeServer). Ensure that $($metadataEndpoint) is accessible.”

if($ExchangeAutodiscoverDomain -eq $NULL -or $ExchangeAutodiscoverDomain -eq “”)
{
Write-Warning “If $($metadataEndpoint) does not exist you may specify an alternate FQDN using ExchangeAutodiscoverDomain.”
}
return
}

Write-Host “Granting Permissions to Exchange Server: $($exchangeServer)”
$appPrincipal = Get-SPAppPrincipal -Site $rootWeb.Url -NameIdentifier $exchange.NameId
Set-SPAppPrincipalPermission -AppPrincipal $appPrincipal -Site $rootWeb -Scope SiteSubscription -Right FullControl -EnableAppOnlyPolicy

Write-Host
Write-Host

Write-Host “Verifying Site Mailbox Configuration”
$warnings = & $script:currentDirectory\Check-SiteMailboxConfig.ps1 -ReturnWarningState

if($warnings -and -not $Force)
{
Write-Warning “Pre-requisites not satisfied. Stopping Set-SiteMailboxConfig. Use -Force to override”
return
}
elseif($warnings)
{
Write-Warning “Pre-requisites not satisfied. -Force used to override”
}

foreach($webapp in $webapps)
{
Write-Host “Configuring Web Application: $($webapp.Url)”
Write-Host “Setting Exchange Site Mailbox Domain to $($ExchangeSiteMailboxDomain)”
$webapp.Properties[“ExchangeTeamMailboxDomain”] = $ExchangeSiteMailboxDomain

if($ExchangeAutodiscoverDomain -ne $NULL -and $ExchangeAutodiscoverDomain -ne “”)
{
Write-Host “Setting Exchange Autodiscover Domain to $($ExchangeAutodiscoverDomain)”
$webapp.Properties[“ExchangeAutodiscoverDomain”] = $ExchangeAutodiscoverDomain;
}

$webapp.Update()
}

$feature = Get-SPFeature CollaborationMailboxFarm -Farm -ErrorAction Ignore

if($feature -eq $NULL)
{
Write-Host “Enabling Site Mailboxes for Farm”
Enable-SPFeature CollaborationMailboxFarm
}
else
{
Write-Host “Site Mailboxes already enabled for Farm”
}
[/code]

Aşağıdaki kodu bir öncei kod ile aynı yere Check-SiteMailboxConfig.ps1 ismiyle kaydedin.

[code lang=”powershell”]
Param
(
[Parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[switch]$ReturnWarningState
)

Add-PSSnapin Microsoft.SharePoint.Powershell

$anyWarnings = $false

Write-Host “Step 1: Checking for Exchange Web Services”

try
{
$assm = [System.Reflection.Assembly]::Load(“Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”)
if($assm.GlobalAssemblyCache)
{
Write-Host -Foreground Green “Found Exchange Web Services in Global Assembly Cache”
Write-Host “Exchange Web Services Version: $([System.Diagnostics.FileVersionInfo]::GetVersionInfo($assm.Location).FileVersion)”
}
else
{
Write-Warning “Unable to find Exchange Web Services in Global Assembly Cache”
$anyWarnings = $true
}
}
catch
{
Write-Warning “Unable to find Exchange Web Services in Global Assembly Cache”
$anyWarnings = $true
}

Write-Host
Write-Host

Write-Host “Step 2: Checking for https web application”

$webapps = Get-SPWebApplication -EA SilentlyContinue

$rootWeb = $NULL

if($webapps -ne $NULL)
{
$sslWebAppExists = $false
foreach($webapp in $webapps)
{
if($rootWeb -eq $NULL)
{
$rootWeb = Get-SPWeb $webApp.Url -EA SilentlyContinue
}

if(-not $webapp.Url.StartsWith(“https://”))
{
Write-Warning “Web Application at $($webapp.Url) does not use HTTPS. Site Mailboxes will not work on this Web Application.”
}
else
{
$sslWebAppExists = $true
Write-Host -Foreground Green “Found Web Application at $($webapp.Url) that uses HTTPS”
}
}

if(-not $sslWebAppExists)
{
Write-Warning “At least one Web Application must be configured for HTTPS in the default zone.”
$anyWarnings = $true
}
}
else
{
Write-Warning “No Web Applications Found. Please create a web application and re-run Check-SiteMailboxConfig”
$anyWarnings = $true
if($ReturnWarningState)
{
return $anyWarnings
}
return;
}

if($rootWeb -eq $NULL)
{
Write-Warning “Unable to find any Sites. Please create a root site collection on a web application and re-run Check-SiteMailboxConfig”
$anyWarnings = $true
if($ReturnWarningState)
{
return $anyWarnings
}
return;
}

# Get App Permissions Management Objects
$appPrincipalManager = [Microsoft.SharePoint.SPAppPrincipalManager]::GetManager($rootWeb)
$appPrincipalPermissionsManager = New-Object -TypeName Microsoft.SharePoint.SPAppPrincipalPermissionsManager -ArgumentList $rootWeb

Write-Host
Write-Host
Write-Host “Step 3: Checking for trusted Exchange Servers”

$trustedIssuers = Get-SPTrustedSecurityTokenIssuer
$trustedIssuerHosts = @()

if($trustedIssuers -ne $NULL)
{
$foundTrustedIssuer = $false
foreach($trustedIssuer in $trustedIssuers)
{
if($trustedIssuer.RegisteredIssuerName.StartsWith(“00000002-0000-0ff1-ce00-000000000000@”))
{
if($trustedIssuer.IsSelfIssuer)
{
$foundTrustedIssuer = $true

$uri = New-Object -TypeName System.Uri -ArgumentList $trustedIssuer.MetadataEndPoint

Write-Host -Foreground Green “Found trusted Exchange Server at $($uri.Host)”
$appPrincipalName = [Microsoft.SharePoint.SPAppPrincipalName]::CreateFromNameIdentifier($trustedIssuer.RegisteredIssuerName)
$appPrincipal = $appPrincipalManager.LookupAppPrincipal([Microsoft.SharePoint.SPAppPrincipalIdentityProvider]::External, $appPrincipalName);

if($appPrincipal -ne $NULL)
{
$isValidAppPrincipal = $true;

if($appPrincipalPermissionsManager.GetAppPrincipalSiteSubscriptionContentPermission($appPrincipal) -eq [Microsoft.SharePoint.SPAppPrincipalPermissionKind]::FullControl)
{
Write-Host -Foreground Green “Exchange Server at $($uri.Host) has Full Control permissions”

}
else
{
Write-Warning “Exchange Server at $($uri.Host) does not have Full Control permissions”
$isValidAppPrincipal = $false;
$anyWarnings = $true
}

if($appPrincipalPermissionsManager.IsAppOnlyPolicyAllowed($appPrincipal))
{
Write-Host -Foreground Green “Exchange Server at $($uri.Host) has App Only Permissions”
}
else
{
Write-Warning “Exchange Server at $($uri.Host) does not have App Only Permissions”
$isValidAppPrincipal = $false;
$anyWarnings = $true
}

if($isValidAppPrincipal)
{
$trustedIssuerHosts += $uri.Host
}

}
else
{
Write-Warning “Unable to get App Principal for $($uri.Host). Unable to check permissions for this Exchange Server”
$anyWarnings = $true
}
}
else
{
Write-Warning “Found trusted Exchange Server at $($uri.Host) but it is not a Self Issuer”
$anyWarnings = $true
}
}
}

if(-not $foundTrustedIssuer)
{
Write-Warning “Unable to find any trusted Exchange Servers”
$anyWarnings = $true
}
}
else
{
Write-Warning “Unable to find any trusted Exchange Servers”
$anyWarnings = $true
}

Write-Host
Write-Host
Write-Host “Step 4: Report current Site Mailbox Configuration”

if($webapps -ne $NULL)
{
foreach($webapp in $webapps)
{
Write-Host
Write-Host “Web Application Site Mailbox Configuration: $($webapp.Url)”
Write-Host “Exchange Site Mailbox Domain: $($webapp.Properties[“ExchangeTeamMailboxDomain”])”

if($webapp.Properties[“ExchangeAutodiscoverDomain”] -ne $NULL)
{
Write-Host “Exchange Autodiscover Domain: $($webapp.Properties[“ExchangeAutodiscoverDomain”])”
}
}
}

Write-Host
Write-Host “Trusted Exchange Services: $([String]::Join(“, “, $trustedIssuerHosts))”

$feature = Get-SPFeature CollaborationMailboxFarm -Farm -ErrorAction Ignore

if($feature -eq $NULL)
{
Write-Host -ForegroundColor Red “Site Mailboxes are NOT enabled for Farm”
}
else
{
Write-Host -ForegroundColor Green “Site Mailboxes are enabled for Farm”
}

if($ReturnWarningState)
{
return $anyWarnings
}
[/code]

Ardından SharePoint Management Shelli çalıştırın ve aşağıdaki komutu kendinize göre düzenleyip çalıştırın.

[code].\Set-SiteMailboxConfig.ps1 -ExchangeSiteMailboxDomain hk.local -ExchangeAutodiscoverDomain exch.hk.local -WebApplicationUrl https://sp[/code]

exch_conf_112

Şimdi de Exchange sunucusuna geçelim ve Exchange Management Shell’i çalıştıralım. EMS içerisinde C:\Program Files\Microsoft\Exchange Server\V15\Scripts klasörüne geçelim ve aşağıdaki komutu kendimize göre düzenleyip çalıştıralım.

[code] .\Configure-EnterprisePartnerApplication.ps1 -ApplicationType Sharepoint -AuthMetadataUrl https://SP_FQDN/_layouts/15/metadata/json/1 [/code]

exch_conf_113

Bu işlemlerden sonra SharePoint portalımızı açalım ve Add an App seçeneğini seçelim.

Varsayılan uygulamalar arasında Site Mailbox’ı görebiliriz.

Site Mailbox’ı seçelim.

exch_conf_114

Portalımızın ana sayfasında sol tarafta Mailbox bağlantısının eklendiğini görebiliriz.

exch_conf_115

Açılan Owa sayfasına Exchange Admin hesabı ile giriş yapalım.

exch_conf_118

Giriş yaptığımızda site mailbox’ın hazırlandığı ile ilgili bir mesaj ile karşılaşacağız.

exch_conf_119

Outlook’umuza Site Mailbox’un oluştrulduğu ile ilgili bir eposta gelecektir.

exch_conf_121

Tarayıcımızı kapatıp tekrar SharePoint portalımıza giriş yapalım ve Mailbox linkine tıklayalım. Açılan OWA sayfasına kendi kullanıcı hesabımız ile giriş yapalım.

exch_conf_122

Gördüğünüz üzere Site Mailbox’ımıza giriş yapabildik.

exch_conf_123

Outlook’umuz içerisinde de Portal sayfamıza ait olan eposta hesabı kendiliğinden eklenecektir.

exch_conf_124

Documents bölümünde daha önce eklemiş olduğumuz dosyaları görebiliriz.

exch_conf_125

Bir sonraki makalemizde görüşmek üzere.

Konunun ana başlığı için: https://hasankoroglu.com/2016/04/19/sharepoint-2013-ve-exchange-2013-yapilandirmasi/

Yorum Bırak »