Skip to main content
Published: November 26 2013, 2:56:00 PMUpdated: November 28 2020, 3:15:59 PM

.NET SDK sample to specify the Item Condition using LookupAttribute.

Summary

If you want to list items in Media categories (Books, DVD and Movies, Music, and Video Game categories), you can specify the Item condition using LookupAttribute, instead specifying it via an attribute.


Detailed Description

This C# example demonstrates how to list a book using its ISBN and LookupAttribute to specify the Item Condition:
 

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

 

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

namespace SDK3Examples
{

public class AddItem
{
public void AddItemWithLookupAttribute(string uuid)
{
    AddItemCall apicall = new AddItemCall(GetContext());
    ItemType item = new ItemType();
    item.Currency = CurrencyCodeType.USD;
    item.Country = CountryCodeType.US;
    item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
    item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PayPal);
    item.PayPalEmailAddress = 'test@foo.com';
    item.Quantity = 1;
    item.PostalCode = '95125';
    item.ListingDuration = 'Days_7';   
    //Set the ISBN
   
item.ExternalProductID = new ExternalProductIDType();
    item.ExternalProductID.Type = ExternalProductCodeType.ISBN;
    item.ExternalProductID.Value = '0439784549';
     //Set the item condition
    item.LookupAttributeArray = new LookupAttributeTypeCollection();
    LookupAttributeType attItemCondition = new LookupAttributeType();
    attItemCondition.Name = 'Condition';
    attItemCondition.Value = 'New';
    item.LookupAttributeArray.Add(attItemCondition);
    item.StartPrice = new AmountType();
    item.StartPrice.currencyID = CurrencyCodeType.USD;
    item.StartPrice.Value = 20;
    item.UUID = uuid;
    item.PictureDetails = new PictureDetailsType();
    //This will automatically use the stock photo and set the gallery image to the stock photo
    item.PictureDetails.GalleryType = GalleryTypeCodeType.Gallery;
    apicall.Execute();
  }

    public ApiContext GetContext()
    {
       ApiContext context = new ApiContext();

  // Credentials for the call
  context.ApiCredential.ApiAccount.Developer = 'devID';
  context.ApiCredential.ApiAccount.Application = 'appID';
  context.ApiCredential.ApiAccount.Certificate = 'certID';
  context.ApiCredential.eBayToken = 'token';

  // Set the URL
  context.SoapApiServerUrl = 'https://api.sandbox.ebay.com/wsapi'; 

  // Set logging
  context.ApiLogManager = newApiLogManager();
  context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger('Messages.log', true, true, true));
  context.ApiLogManager.EnableLogging = true;

  // Set the version
  context.Version = '495';

  return context;

    }

}

}


 


Version Info

The code example above was based on the versions specified below:

API Schema Version 495
.NET SDK Version .NET SDK v495.0 full release



Additional Resources

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