Home
Find the answer to your question
Sample code in C# to remove BuyItNowPrice and Pictures from an Item using .NET SDK
Summary
Depending on what you want to delete, you either need to send in the information
again in your call or send it in the DeletedField list.
/*
using System; namespace SDK3Examples
public class RelistItem
}
{
public string RelistItem(string
itemID, string
UUID)
{ RelistItemCall apicall = new RelistItemCall(GetContext()); ItemType item = new ItemType(); item.ItemID = ItemID; apicall.DeletedFieldList = new StringCollection(); // Remove the BuyItNowPrice apicall.DeletedFieldList.Add('Item.BuyItNowPrice'); //Remove All the pictures apicall.DeletedFieldList.Add('Item.PictureDetails.PictureURL'); item.PictureDetails = new PictureDetailsType(); // Set the GalleryURL and PhotoDisplay to None item.PictureDetails.GalleryType = GalleryTypeCodeType.None; item.PictureDetails.PhotoDisplay = PhotoDisplayCodeType.None; //Remove All the pictures //To modify the Pictures //item.PictureDetails = new PictureDetailsType(); //item.PictureDetails.PictureURL = new StringCollection(); //item.PictureDetails.PictureURL.Add('http://www.mydomain.com/picture1.jpg'); //item.PictureDetails.GalleryType = GalleryTypeCodeType.None; //item.PictureDetails.PhotoDisplay = PhotoDisplayCodeType.None; //To modify the Pictures item.UUID = UUID; apicall.RelistItem(item); FeeTypeCollection fees = addItem.AddItem(item); return apicall.ItemID; } public ApiContext
GetContext()
// 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 // Set logging // Set the version return context; } |
To replace the pictures with new pictures, comment the Block 'Remove All the pictures' and uncomment the block 'To modify the Pictures'. If you need to set the GalleryURL or specify multiple pictures, set the GalleryType and PhotoDisplay accordingly.
Here is the SOAP Request to Remove BuyItNowPrice and All Pictures:
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Header>
<RequesterCredentials xmlns='urn:ebay:apis:eBLBaseComponents'>
<eBayAuthToken>******</eBayAuthToken>
<Credentials>
<AppId/>
<DevId/>
<AuthCert/>
</Credentials>
</RequesterCredentials>
</soap:Header>
<soap:Body>
<RelistItemRequest xmlns='urn:ebay:apis:eBLBaseComponents'>
<MessageID>ef57b868-5335-4600-b611-cbe416d81551</MessageID>
<Version>485</Version>
<Item>
<ItemID>110015328466</ItemID>
<PictureDetails>
<GalleryType>None</GalleryType>
<PhotoDisplay>None</PhotoDisplay>
</PictureDetails>
</Item>
<DeletedField>Item.BuyItNowPrice</DeletedField>
<DeletedField>Item.PictureDetails.PictureURL</DeletedField>
</RelistItemRequest>
</soap:Body>
</soap:Envelope>
Here is the SOAP request to replace the existing pictures:
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Header>
<RequesterCredentials xmlns='urn:ebay:apis:eBLBaseComponents'>
<eBayAuthToken>******</eBayAuthToken>
<Credentials>
<AppId/>
<DevId/>
<AuthCert/>
</Credentials>
</RequesterCredentials>
</soap:Header>
<soap:Body>
<RelistItemRequest xmlns='urn:ebay:apis:eBLBaseComponents'>
<MessageID>2ca341b6-f706-4b3f-9a75-186f622d7b53</MessageID>
<Version>485</Version>
<Item>
<ItemID>110015328466</ItemID>
<PictureDetails>
<GalleryType>None</GalleryType>
<PhotoDisplay>None</PhotoDisplay>
<PictureURL>http://www.mydomain.com/picture1.jpg</PictureURL>
</PictureDetails>
</Item>
<DeletedField>Item.BuyItNowPrice</DeletedField>
</RelistItemRequest>
</soap:Body>
</soap:Envelope>
Version Info
The code example above was based on the versions specified below:
API Schema Version | 485 |
.NET SDK Version | .NET SDK v485.0 full release |