Developers Program

GetSellerEvents sample using .NET SDK C#

Published: January 06 2012, 3:49:00 PM·Updated: August 24 2022, 9:03:36 PM

Products

Question

How can I make a simple GetSellerEvents call using the .NET SDK (C#)?

Answer

Summary

GetSellerEvents C# sample


Detailed Description

This sample is using Microsoft Visual Studio 2010, eBay .NET SDK

Requirements:

After opening a C# project,

- Add a reference to eBay.Service dll

- Make sure Target Framework is NOT set to .NET Framework Client Profile

1. Add these namespaces

using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;

2. Code Sample (This sample was in a windows form project in a button click):

/*
© 2012-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
*/

ApiContext oContext = new ApiContext();

//' set the AuthToken
oContext.ApiCredential.eBayToken = "xxx";
//oContext.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";
oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi";

//' set the Site of the Context
oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US;
oContext.ErrorLanguage = ErrorLanguageCodeType.en_US;

//' the WSDL Version used for this SDK build
oContext.Version = "1235";

// very important, let's setup the logging
ApiLogManager oLogManager = new ApiLogManager();
oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetSellerEvents.log", true, true, true));
oLogManager.EnableLogging = true;
oContext.ApiLogManager = oLogManager;

GetSellerEventsCall oGetSellerEventsCall = new GetSellerEventsCall(oContext);

//' set the Version used in the call
oGetSellerEventsCall.Version = oContext.Version;

//' set the Site of the call
oGetSellerEventsCall.Site = oContext.Site;

//' enable the compression feature
oGetSellerEventsCall.EnableCompression = true;

oGetSellerEventsCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

DateTime ModTimeFrom, ModTimeTo;
//CreateTimeTo set to the current time
ModTimeTo = DateTime.ParseExact("2022-08-04 11:59:59", "yyyy-MM-dd hh:mm:ss", null);
//CreateTimeTo set to the current time
ModTimeFrom = DateTime.ParseExact("2022-08-04 11:00:04", "yyyy-MM-dd hh:mm:ss", null);

oGetSellerEventsCall.GetSellerEvents(ModTimeFrom, ModTimeTo);

//Add code to filter response here.........


Additional Resources
How well did this answer your question?