Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community

Adding OneDrive for business sites to a dlp policy using powershell

Brass Contributor

Hi All

 

I wonder if anyone can help.  I am trying to add a list of onedrive for business sites to a dlp policy.  The code I am using is:

 

$new = import-csv C:\Temp\sitestoadd.csv

$newlocations = $new.OD4BSites

Set-DlpCompliancePolicy -Identity "Personally Identifiable Information (PII) - External" -AddOneDriveLocation $newlocations

 

I am getting the error shown below:

 

Cannot process argument transformation on parameter 'AddOneDriveLocation'. Cannot convert value "https://xxxuk-my.sharepoint.com/personal/x_xxxxx_xxx_com to type "Microsoft.Exchange.Data.MultiValuedProperty`1[System.String]" + CategoryInfo : InvalidData: (:) [Set-DlpCompliancePolicy], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-DlpCompliancePolicy
+ PSComputerName : eur03b.ps.compliance.protection.outlook.com

 

I have searched and searched but cannot find an answer.

 

 

Does anyone have any ideas?

 

Many thanks

2 Replies

Might help if you show us what the variable is set to. You can pass either a list variable, or comma separated values.

 

It’s imported from a csv so comma separated?