Adding OneDrive for business sites to a dlp policy using powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-1570785%22%20slang%3D%22en-US%22%3EAdding%20OneDrive%20for%20business%20sites%20to%20a%20dlp%20policy%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570785%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20wonder%20if%20anyone%20can%20help.%26nbsp%3B%20I%20am%20trying%20to%20add%20a%20list%20of%20onedrive%20for%20business%20sites%20to%20a%20dlp%20policy.%26nbsp%3B%20The%20code%20I%20am%20using%20is%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24new%20%3D%20import-csv%20C%3A%5CTemp%5Csitestoadd.csv%3C%2FP%3E%3CP%3E%24newlocations%20%3D%20%24new.OD4BSites%3C%2FP%3E%3CP%3ESet-DlpCompliancePolicy%20-Identity%20%22Personally%20Identifiable%20Information%20(PII)%20-%20External%22%20-AddOneDriveLocation%20%24newlocations%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20getting%20the%20error%20shown%20below%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECannot%20process%20argument%20transformation%20on%20parameter%20'AddOneDriveLocation'.%20Cannot%20convert%20value%20%22%3CA%20href%3D%22https%3A%2F%2Fxxxuk-my.sharepoint.com%2Fpersonal%2Fx_xxxxx_xxx_com%26nbsp%3Bto%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxxuk-my.sharepoint.com%2Fpersonal%2Fx_xxxxx_xxx_com%26nbsp%3Bto%3C%2FA%3E%20type%20%22Microsoft.Exchange.Data.MultiValuedProperty%601%5BSystem.String%5D%22%26nbsp%3B%2B%20CategoryInfo%20%3A%20InvalidData%3A%20(%3A)%20%5BSet-DlpCompliancePolicy%5D%2C%20ParameterBindin...mationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ParameterArgumentTransformationError%2CSet-DlpCompliancePolicy%3CBR%20%2F%3E%2B%20PSComputerName%20%3A%20eur03b.ps.compliance.protection.outlook.com%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20searched%20and%20searched%20but%20cannot%20find%20an%20answer.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20have%20any%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1570785%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDLP%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOneDrive%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%20%26amp%3B%20Compliance%20Center%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1570971%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20OneDrive%20for%20business%20sites%20to%20a%20dlp%20policy%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570971%22%20slang%3D%22en-US%22%3E%3CP%3EMight%20help%20if%20you%20show%20us%20what%20the%20variable%20is%20set%20to.%20You%20can%20pass%20either%20a%20list%20variable%2C%20or%20comma%20separated%20values.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1571098%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20OneDrive%20for%20business%20sites%20to%20a%20dlp%20policy%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1571098%22%20slang%3D%22en-US%22%3EIt%E2%80%99s%20imported%20from%20a%20csv%20so%20comma%20separated%3F%3C%2FLINGO-BODY%3E
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?
We support Ukraine and condemn war. Push Russian government to act against war. Be brave, vocal and show your support to Ukraine. Follow the latest news HERE