SWS RemoveRentalFromAuction Method
Removes the selected rental or rentals from the auction to which they are assigned.
Parameters
Name | DataType | Is Required |
---|---|---|
RentalIDs | ArrayOfLong5 | Required |
Description | The rental ID or an array of rental IDs to be removed from auction. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
RentalsSucceeded | ArrayOfLong7 |
Description | The array of rental IDs that were successfully removed from the auction. |
RentalsFailed | ArrayOfLong8 |
Description | The array of rental IDs that failed to be removed from the auction. |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, a RemoveRentalFromAuction request object and a RemoveRentalFromAuction response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.RemoveRentalFromAuction_Request request = new
SWS.RemoveRentalFromAuction_Request();
SWS.RemoveRentalFromAuction_Response response;
Here’s my sample code of the Request object.
// RemoveRentalFromAuction Request
request.SiteID = 123456;
request.RentalIDs = new long[] { 123456, 456789, 789123 };
Finally we can call the method and pass across the login object and the request object to remove our rental from auction. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.RemoveRentalFromAuction(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.