Hi,
I need to create xml file and then need to upload into drive location.
Below code for creating xml file and download into local machine.
#region Actions
public PXAction<POOrder> MyAction;
[PXUIField(DisplayName = "Export XML", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(CommitChanges = true)]
public virtual IEnumerable myAction(PXAdapter adapter){
XmlDocument xmlDoc = new XmlDocument();
XmlDeclaration xmldecl;
xmldecl=xmlDoc.CreateXmlDeclaration("1.0", null, null);
// Create root node of XML file
XmlNode rootNode = xmlDoc.CreateElement("GridData");
foreach (InventoryItem dacRecord in dataview.Select())
{
// Create an XML Element to represent the DAC row
XmlNode xmlDACRecord = xmlDoc.CreateElement("DACRecord");
// Add desired DAC fields as child XML Elements of the DAC row XML element
XmlNode xmlDACField1 = xmlDoc.CreateElement("ItemType");
xmlDACField1.AppendChild(xmlDoc.CreateTextNode(dacRecord.ItemType.ToString()));
xmlDACRecord.AppendChild(xmlDACField1);
XmlNode xmlDACField2 = xmlDoc.CreateElement("Item");
xmlDACField2.AppendChild(xmlDoc.CreateTextNode(dacRecord.InventoryCD.ToString()));
xmlDACRecord.AppendChild(xmlDACField2);
// Adding XML DAC Record to XML root node
rootNode.AppendChild(xmlDACRecord);
}
// Adding XML root node to XML document
xmlDoc.AppendChild(rootNode);
// Redirect browser to XML file created in memory on server
throw new PXRedirectToFileException(new PX.SM.FileInfo(Guid.NewGuid(),
"filename.xml",
null,
System.Text.Encoding.UTF8.GetBytes(xmlDoc.OuterXml)),
true);
return adapter.Get();
}
#endregion
Can you please help for me to upload this file into drive location using acumatica.