I am trying to fetch data from Data extension using C# by following this link
my code is:
ET_Client myclient = new ET_Client(); ET_DataExtension dataextension = new ET_DataExtension(); dataextension.AuthStub = myclient; GetReturn response = dataextension.Get(); Console.WriteLine("Get Status: " + response.Status.ToString());
Here I am getting error “Must specify valid information for parsing in the string” Please help.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I too had the same problem as the OP.
I investigated Ajit’s recommendation to set the SearchFilter and Props and discovered that only the Props need to be specified. Also if you try to specify all the properties listed on the help documentation, two of the properties will cause you issues.
- IsPlatformObject
Adding this prop, at the time of writing this, breaks the Name property on the returned DataExtensions prop (if you’ve specified it) and the Name property will be null.
- DataRetentionPeriod
This seems to be the culprit of the error the OP is talking about. If you include it, or if you don’t specify any props, you’ll get the error.
To be able to retrieve all Data Extensions, specify all but the two offending.
Like this:
ET_Client myclient = new ET_Client(); ET_DataExtension dataextension = new ET_DataExtension(); dataextension.AuthStub = myclient; dataextension.Props = new[] { "ObjectID", "PartnerKey", "CustomerKey", "Name", "CreatedDate", "ModifiedDate", "Client.ID", "Description", "IsSendable", "IsTestable", "SendableDataExtensionField.Name", "SendableSubscriberField.Name", "Template.CustomerKey", "CategoryID", "Status", "DataRetentionPeriodLength", "DataRetentionPeriodUnitOfMeasure", "RowBasedRetention", "ResetRetentionPeriodOnImport", "DeleteAtEndOfRetentionPeriod", "RetainUntil" }; GetReturn response = dataextension.Get(); Console.WriteLine("Get Status: " + response.Status.ToString());
Hope this helps someone as it was bugging me that it doesn’t work OOB like all the other objects.
Method 2
I ran into similar problem, but if I remember correctly, I set the props I wanted to get and also filtered the results and it worked.
For example, dataextension.props = [‘Name’, ‘CustomerKey’]
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0