Download list members

May 10, 2010 at 10:31 PM

Hi There,

I am trying to download a list and am having some problems.  I would like to automate: Lists - View Lists - View All - Download.  Is the code below almost there? 

Please fill me in if you have any ideas.

Thank you.

Paul O

            listMembersInput lmi = new listMembersInput();
            lmi.apikey = apikey;
            lmi.id = "adfkj3kljd";
            listMembers lm = new listMembers(lmi);
            listMembersOutput lmo = new listMembersOutput(lmi);

            lmo.api_OutputType = EnumValues.OutputType.XML;
            lmo = lm.Execute();

 


Coordinator
May 11, 2010 at 5:08 PM
Edited May 11, 2010 at 5:19 PM

The pattern used to invoke an api call is consistent for all methods, and is as follows...

1) create input class and assign values

2) override any api directives, if required

3) create in instance of the method class, passing the input class into the constructor

4) execute the method which returns the output class (Output class isn't created independently)

5) Check output for errors, and process result if no errors

so for your case....

// #1

listMembersInput lmi = new listMembersInput();
lmi.apikey = apikey;
lmi.id = "adfkj3kljd";

// #2
// --------- XML output only valid with Serial access, so make sure that's set as well
// --------- and these values must be set in the Input class before being passed to the method constructor

lmi.api_AccessType = EnumValues.AccessType.Serial;
lmi.api_OutputType = EnumValues.OutputType.XML;

// #3
listMembers lm = new listMembers(lmi);

// #4
listMembersOutput lmo = lm.Execute();

// #5

if ( api_ErrorMessages.Count == 0 ) 
  {  // process result }
else
  {  // process error }

 

Hope that helps,

David

May 11, 2010 at 6:53 PM

Thanks Dave.  That helps.  I just may get the hang of this.

Paul