Thursday, August 11, 2016

Read Image from AX to web service AIF .Net

//Read Image from AX to web service AIF .Net

public str  GetEmplImage(Description employeeId)
{
    str             content;
   
   XmlDocument  getImageXml(Description _employeeId)
   {
        XmlDocument xmlEnvelope;
        XmlElement childNode;
        str contentloc;
        HcmWorker       worker;
        HcmPersonImage  PersonImage;
  
        CompanyImage ci;
  
         BinData bin = new BinData();       
        worker = HcmWorker::findByPersonnelNumber(_employeeId);
   
        select firstOnly PersonImage
                where PersonImage.Person == worker.Person;
      
        bin.setData(PersonImage.Image);
        contentloc = bin.base64Encode();
        xmlEnvelope = new XmlDocument();
        childNode =  xmlEnvelope.CreateElement("image");
        childNode.innerXml(contentloc);
        xmlEnvelope.AppendChild(childNode);
        return xmlEnvelope;
    }
    ;   
    content = getImageXml(employeeId).xml();
    return content;
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...