GetShipmentDocuments Method
Generates a shipping label using one of domestic UPS services.
Syntax
[VB.NET] Public Sub GetShipmentDocuments()
[C#] public void GetShipmentDocuments();
Remarks
The following properties must be set before calling this method:
- Server (required)
- AccessKey (required)
- Password (required)
- UserId (required)
- AccountNumber (required)
- SenderContact (required)
- SenderAddress (required)
- RecipientContact (required)
- RecipientAddress (required)
- Documents (required)
- Commodities (required)
- WeightUnit (required; defaults to LBS)
Upon successful response, the following fields will be populated:
The documents will be written to the filenames set in Documents.Code example:
component.UPSAccount.Server = "https://wwwcie.ups.com/webservices/FreightShip"; component.UPSAccount.AccessKey = "Your Access Key"; component.UPSAccount.UserId = "User Id"; component.UPSAccount.Password = "Password"; component.UPSAccount.AccountNumber = "000000"; component.SenderContact.Company = "Developer Test 1"; component.SenderContact.Phone = "884530171"; component.SenderAddress.Address1 = "101 Developer Way"; component.SenderAddress.City = "Richmond"; component.SenderAddress.State = "VA"; component.SenderAddress.ZipCode = "23224"; component.SenderAddress.CountryCode = "US"; component.RecipientContact.Company = "Consignee Test 1"; component.RecipientAddress.Address1 = "1000 Consignee Street"; component.RecipientAddress.City = "Allanton"; component.RecipientAddress.State = "MO"; component.RecipientAddress.ZipCode = "63001"; component.RecipientAddress.CountryCode = "US"; component.Payor.PayorType = TPayorTypes.ptSender; component.HandlingUnit = "SKD:1"; CommodityDetail item = new CommodityDetail(); item.Description = "LCD TVS"; item.FreightClass = "77.5"; item.Weight = "150"; item.FreightNMFC = "132680"; item.FreightNMFCSub = "02"; item.NumberOfPieces = 20; item.Value = "100"; component.Commodities.Add(item); DocumentInfo label = new DocumentInfo(); label.FileName = "TestLabel.pdf"; label.PrintFormat = TFreightPrintFormats.fpfLaser; label.PrintSize = TFreightPrintSizes.fpsSize8X11; label.DocumentType = TFreightTypeCodes.ftcLabel; component.Documents.Add(label); component.GetShipmentDocuments(); Console.WriteLine("Total Charge: " + component.TotalCharge); for (int i = 0; i < component.Charges.Count; i++) { Console.WriteLine(component.Charges[i].ChargeType + ": " + component.Charges[i].Value); } Console.WriteLine("Billable Weight: " + component.BillableWeight); Console.WriteLine("BOLID: " + component.BOLID); Console.WriteLine("Shipment Number: " + component.ShipmentNumber);NOTE: This method has a corresponding asynchronous version (GetShipmentDocumentsAsync) for use in the WinRT environment.