Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Question about Exception calling “CreateDataDrivenSubscription” with “7” argument(s): “There was an error generating the XML document.

$
0
0

Hello guys, I’m trying to convert MSDN C# code to PowerShell script.

I almost finished the conversion but I encounter some issues for my last line.

Here’s the PowerShell script:

$Parameters | Add-Member -type NoteProperty -Name $EMPID.ParameterName -Value $EMPID.FieldAlias $ReportYear = New-Object $ParameterValue $ReportYear.Name = "ReportYear" $ReportYear.Value = "2017" $Parameters | Add-Member -type NoteProperty -Name $ReportYear.Name -Value $ReportYear.Value $ReportMonth = New-Object $ParameterValue $ReportMonth.Name = "ReportMonth" $ReportMonth.Value = "6" $Parameters | Add-Member -Type NoteProperty -Name $ReportMonth.Name -Value $ReportMonth.Value $SubscriptionID = $objWebServerProxy.CreateDataDrivenSubscription($Report,$Settings,$arrDataRetrievalPlan,$Description,$EventType,$MatchData,$Parameters) 

Here’s the C# code

ParameterValueOrFieldReference[] parameters = new ParameterValueOrFieldReference[3]; ParameterFieldReference empID = new ParameterFieldReference(); // Data-driven. empID.ParameterName = "EmpID"; empID.FieldAlias = "EmpID"; parameters[0] = empID; ParameterValue reportYear = new ParameterValue(); reportYear.Name = "ReportYear"; reportYear.Value = "2004"; parameters[1] = reportYear; ParameterValue reportMonth = new ParameterValue(); reportMonth.Name = "ReportMonth"; reportMonth.Value = "6"; // June parameters[2] = reportMonth; try { string subscriptionID = rs.CreateDataDrivenSubscription( 

report, settings, dataRetrieval, description, eventType, matchData, parameters);

Can you tell me where did I miss on the conversion?

submitted by /u/mdennis07
[link] [comments]

The post Question about Exception calling “CreateDataDrivenSubscription” with “7” argument(s): “There was an error generating the XML document. appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles