Find path by using email:
search ***@company.com or ***@company.onmicrosoft.com if find the object, the SMTP has been used.
Get-MailPublicFolder "***@company.onmicrosoft.com" | FL *Guid*
We can use the GUID to location the path in public folder
Get-PublicFolder -Recurse -resultsize unlimited | ?{$_.MailRecipientGuid -eq "***-****-****-****-*****"}
| select -ExpandProperty folderpath
Using regex to identify number in Powershell
$myvar
-match
"^\d+$" #pure number
$myvar
-match
".*\d+.*" #*number*
Find the public folder path by searching email (Not work for Exchange Online O365)
Login Office 365 Powershell$LiveUsername='***@***.com'
$LivePassword=''
$LiveCred = New-Object System.Management.Automation.PsCredential($LiveUsername,
(ConvertTo-SecureString $LivePassword -AsPlainText -Force))
Import-Module MSOnline
Connect-MsolService -Credential $LiveCred
$msoExchangeURL = “https://ps.outlook.com/powershell/”
$session =New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
$msoExchangeURL -Credential $Livecred -Authentication Basic -AllowRedirection
Import-PSSession $session
Updated 2020/10
$LiveUsername='***@***.com'
$LivePassword=''
$LiveCred = New-Object System.Management.Automation.PsCredential($LiveUsername,(ConvertTo-SecureString $LivePassword -AsPlainText -Force))
#$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
No comments:
Post a Comment