Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-MgAgreement cmdlet fails with value cannot be null - parameter name source #652

Closed
dwanjuhi opened this issue May 5, 2021 · 3 comments
Milestone

Comments

@dwanjuhi
Copy link

dwanjuhi commented May 5, 2021

When using the New-MgAgreement cmdlet to create a terms of use file - running the command returns "value cannot be null - parameter name source". Adding a "source" parameter to the New-MgAgreement cmdlet returns tells me "a parameter cannot be found that matches parameter name 'source' - which is correct per the documentation.

This issue was first reported on Stack Overflow

See below screenshot with details:
NewMgGraphAgreementRegression

AB#9286

@ghost ghost added the ToTriage label May 5, 2021
@peombwa peombwa added this to the Backlog milestone May 6, 2021
@peombwa
Copy link
Member

peombwa commented May 6, 2021

Thanks for the repro. This does indeed look like a bug with how this command serializes FileData. I'll repro and offer a fix soon.

As a workaround, I'd recommend you use Invoke-MgGraphRequest as described in the StackOverflow answer.

@dwanjuhi
Copy link
Author

dwanjuhi commented May 7, 2021

Thank you @peombwa 👯

@peombwa
Copy link
Member

peombwa commented May 13, 2022

This is now supported by the command:

$data = @{
	DisplayName = "Contoso ToU for guest users"
	IsViewingBeforeAcceptanceRequired = $true
	Files = @(
		@{
			FileName = "TOU.pdf"
			Language = "en"
			IsDefault = $true
			FileData = @{
				Data =  [System.IO.File]::ReadAllBytes("PATH_TO_FILE.pdf")
			}
		}
	)
}

New-MgAgreement -BodyParameter $data -Debug

See the example at https://docs.microsoft.com/en-us/graph/api/termsofusecontainer-post-agreements?view=graph-rest-beta&tabs=powershell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants