SWS AddRentalsToAuction Method
Allows you to add multiple rental items to an existing rental auction. See the CreateAuction SWS method for information on creating a rental auction.
Parameters
Name | DataType | Is Required |
---|---|---|
AssessFee | Boolean | Required |
Description | Indicates whether a fee will be assessed (“True”) or not (“False”) when the rental is added to auction. Defaults to “False” if left undefined. | |
AuctionID | Long | Required |
Description | The auction’s ID number. This information is returned when you use the CreateAuction method or can be retrieved using the GetAuctions method. | |
CreateLetter | Boolean | Required |
Description | Indicates whether a letter will be sent (“True”) or not (“False”) when the rental is added to auction. Defaults to “False” if left undefined. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. | |
Notes | String | Optional |
Description | The notes associated with a rental item. This is free flow text with a max string length of 4000. | |
RentalID | Long | Required |
Description | The rental item’s ID number. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
UnitContents | String | Optional |
Description | The description of what is contained within the rental item being auctioned. This is freeflow text with a max string length of 4000. |
Returned Parameters
Name | DataType |
---|---|
ErrorMsg | String |
Description | An error message for each rental item that failed to be assigned to an auction. Max string length of 500. |
RentalID | Long |
Description | The rental item’s ID number. |
Succeeded | Boolean |
Description | Indicates if the rental was successfully added to the auction (“True”) or not (“False”). |
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, an AddRentalsToAuction request object and an AddRentalsToAuction response object. We can define and create those like this:
// Create request and response objects and rental item object.
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.AddRentalsToAuction_Request request = new SWS.AddRentalsToAuction_Request();
SWS.AddRentalToAuction_Response response;
SWS.AuctionRentalItemData rentalData = new SWS.AuctionRentalItemData();
Here’s my sample code of the Request object.
//Create rental data parameters rentalData.RentalID = 123456; rentalData.UnitContents = "assorted boxes and a dining room set."; rentalData.Notes = "This is for whatever notes you wish to add."; //Add rentals to auction request object request.AuctionID = 123456; request.CreateLetter = true; request.AssessFee = true; request.SiteID = 123456; request.Rentals = new SWS.AuctionRentalItemData[] { rentalData };
Finally we can call the method and pass across the login object and the request object for adding rentals to an auction. It’s a good idea to do this in a Try Catch block.
try
{
// Call the method that will load the response object
response = service.AddRentalsToAuction(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.