Solution for Que 1:
You can use Exchange Online PowerShell and a CSV (comma-separated value) file to bulk import external contacts into Exchange Online. It's a three-step process:
Step 1: Create a CSV file that contains information about the external contacts
Step 2: Create the external contacts with PowerShell
Step 3: Add information to the properties of the external contacts
Check detail step here - https://learn.microsoft.com/en-us/microsoft-365/compliance/bulk-import-external-contacts?view=o365-worldwide
Solution for Que 2:
- Connect to Office 365 PowerShell, run the PowerShell ISE as Administrator and execute the following command: Set-ExecutionPolicy RemoteSigned
$Cred = Get-Credential - Type your user ID and password in the Windows PowerShell Credential Request and click OK.
- Create a session using the following command, modifying –ConnectionUri parameter based on your Exchange Online location: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic –AllowRedirection
- Connect to Exchange Online:
Import-PSSession $Session –DisableNameChecking
- Copy and run the following script, adjusting the filters for the specific user you want to report on and specifying the desired path for the CSV file output: Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission |Select-Object Identity,User,AccessRights | Where-Object {($_.user -like '@')}|Export-Csv C:\Temp\sharedfolders.csv -NoTypeInformation
- Review the resulting CSV report:
- Terminate your session with following cmdlet: Remove-PSSession$Session