File Mover Blog

  • 11 Nov

    Pascal Script Xml Functions added to Limagito File Mover

    Pascal Script Xml Functions added to Limagito File Mover

    We added two extra Pascal Script functions in version v2020.11.11.0.

    • Function psXMLGetAttribute(Const aXML, aRootNode, aChildNode, aAttrName: String): String;
    • Function psXMLSetAttribute(Const aXML, aRootNode, aChildNode, aAttrName, aAttrValue: String): String;

    These functions allow you to Get and Set Xml Attributes. aRootNode or aChildNode can be empty. We prepared the Pascal Script engine to be ready for other Xml requests users may have. Don’t hesitate to ask for extra Xml features.

    We added these functions because we received the following request:

    Currently I have different XML-Files which more or less will have static file contents besides that it would be needed to update one field with the current date of the day. Scheduler will be used and set to run every weekday at approx. 23:59:59.  In the files the XML-field document > date need to be updated in date format YYYY-MM-DD.

    Example for today (2020-11-11):

    <document level=”01-01-xx-xx-xx” date=”2020-11-11″ name=”davinci”>

    Rest of the file contents stays unchanged.

     

    • In the following example will change the value of a node attribute. The Source will be a Xml file (WIN as Source).

    Limagito File Mover WIN as Source

    • The Destination is Pascal Script. The Script will use these new function and write the adjusted Xml content to a new file.

    Limagito File Mover Pascal Script as Destination

    • Don’t forget to adjust the Const ctDest to the path you need the adjusted xml to be saved in.

    Var
      iList: Integer;
      tmpDateStr: String;
      tmpList: TStringList;
      tmpPos: Integer;
      tmpXml: String;
    Const
      ctDest = 'C:\Test\In\Patrick\Out\';
    Begin
      psExitCode:= 0;
      // ... add your code here
      // 
      // 
      // 
      tmpList := TStringList.Create;
      Try
        Try
          // Load Xml File
          psLogWrite(1, '', 'Loading ' + psFilePath + psFileName);
          tmpList.LoadFromFile(psFilePath + psFileName);
          // Prepare Date as String
          tmpDateStr := FormatDateTime('YYYY-MM-DD', Now); // i.e. 2020-11-10
          // Function psXMLGetAttribute(Const aXML, aRootNode, aChildNode, aAttrName): String;
          tmpXml := psXMLGetAttribute(Trim(tmpList.Text), 'document', '', 'date');
          psLogWrite(1, '', 'XML Get Date Attr Value: ' + tmpXML);
          // Function psXMLSetAttribute(Const aXML, aRootNode, aChildNode, aAttrName, aAttrValue: String): String;
          psLogWrite(1, '', 'XML Set Date Attr Valuet ' + tmpDateStr);
          tmpXml := psXMLSetAttribute(Trim(tmpList.Text), 'document', '', 'date', tmpDateStr);
          // Save To File
          // psLogWrite(1, '', 'XML Result: ' + tmpXml);
          tmpList.Text := Trim(tmpXML);
          Try
            tmpList.SaveToFile(ctDest + psFileName);
            psLogWrite(1, '', 'SaveToFile: ' + psFilePath + psFileName + ' Successful');
            // Set Result
            psExitCode:= 1;
          Except
            psLogWrite(1, '', 'SaveToFile:' + psFilePath + psFileName + ' Error');
          End;
        Except
          psLogWrite(1, '', 'LoadFromFile: ' + psFilePath + psFileName + ' Error');
        End;
      Finally
        tmpList.Free;
      End;
    End.
    

     

    • Original Source Xml file contains a Date attribute with value “2018-11-30”:

    Limagito File Mover Xml Source example

    • The new Destination Xml file contains the adjusted Date attribute with value “2020-11-11”:

    Limagito File Mover Xml Destination Example

    • RunTime log result:

    Limagito File Mover Xml RunTime Log

    If you need any help with these Pascal Script ‘Xml functions’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Pascal Script XML ,
  • 11 Nov
  • 08 Nov

    Added SharePoint as Source in Limagito File Mover

    In version v2020.11.8 we added SharePoint as Source in Limagito File Mover. Once more, special thanks to Brad who helped us with the test account, much appreciated. In the next couple of weeks we’ll add SharePoint to the Web Remote Tool.

    Limagito File Mover Sharepoint as Source

    SharePoint Source Setup:

    We currently provide 4 authentication methods:

    1. Online Authentication Method:
      • Is the one we used during our tests. The end result of authentication is to establish an HTTP cookie, named “SPOIDCRL”, that contains a binary security token to be sent in subsequent SharePoint HTTPS requests. This cookie is kept in memory (not saved to disk).
      • We need your Username (i.e. myname@mycompany.com) and Password
    2. NTLM Authentication Method (Windows classic mode authentication):
      • For example, imagine our SharePoint endpoint is ‘https://xyzoffice.mycompany.com/’
        • The Site Url would be: https://xyzoffice.mycompany.com
        • The NTLM Domain would be: mycompany.com
        • The Username would be just the name, not a full email address.
          • For example: myname instead of myname@mycompany.com.
    3. Online Authentication using Client Credentials without User Dialog
      • In this case you don’t need to use the Username and Password fields
      • We will use your Client ID and Client Secret from the OAuth2 tab instead
    4. Online Authentication using OAth2

    >Screenshot setup using authentication method 1)

    Limagito File Mover Sharepoint as Source Setup

    >Screenshots setup using authentication method 3)

    Limagito File Mover SharePoint Setup

    Limagito File Mover SharePoint Client Credentials

    SharePoint RunTime Log result

    Limagito File Mover Sharepoint as Source RunTime Log

    If you need any help with ‘SharePoint as Source’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team SharePoint ,
1 72 73 74 75 76 77 78 136
SEARCH