Skip to main content
Published: March 18 2009, 1:46:00 PMUpdated: November 28 2020, 5:21:39 PM

 

I am making a call to getJobs to get a report of my AddFixedPriceItem jobs for the past 7 days, however going by the response it seems that the time filter values that I am setting are being ignored. I am using SOAP with .NET.  How can I get this to work? Below is my code snippet.

                           GetJobsRequest req = new GetJobsRequest();

                            DateTime start, end;
                            start = DateTime.Now.AddDays(-7).ToUniversalTime();
                            end = DateTime.Now.ToUniversalTime();

                             //Adding time filter
                            req.creationTimeFrom = start;
                            req.creationTimeTo = end;

                            req.jobType = new string[1];
                            req.jobType[0] = "AddFixedPriceItem";

                           req.jobStatus = new JobStatus[1];
                           req.jobStatus[0] = JobStatus.Completed;

                            GetJobsResponse resp = client.getJobs(req);

The creationTimeFrom and creationTimeTo optional input fields. Since they are optional, ..NET adds the Specified property which needs to be set to true if you want to include those fields when making the call. If you change your code to include the highlighted lines you will see that the time filter fields are being taken into account.

                           GetJobsRequest req = new GetJobsRequest();

                            DateTime start, end;
                            start = DateTime.Now.AddDays(-7).ToUniversalTime();
                            end = DateTime.Now.ToUniversalTime();

                             //Adding time filter
                            req.creationTimeFrom = start;
                            req.creationTimeTo = end;

                            req.creationTimeFromSpecified = true;
                            req.creationTimeToSpecified = true;

                            req.jobType = new string[1];
                            req.jobType[0] = "AddFixedPriceItem";

                           req.jobStatus = new JobStatus[1];
                           req.jobStatus[0] = JobStatus.Completed;

                            GetJobsResponse resp = client.getJobs(req);

 

How well did this answer your question?
Answers others found helpful