×
Menu
Index

SynchronizeFromSP

This function synchronizes List items data from SharePoint to NAV/BC.
 
Prerequisites:
 
Parameters:
 
List Setup Example:
 
Code Example:
This code synchronizes data from example Employees SharePoint List to NAV/BC. If there is a value set in EmployeeNoFilter variable, NavSherpa will filter the SharePoint data selection according to it.
 
  //Set SharePoint query filters
  SyncFromSPDateTime := CREATEDATETIME(081111D,020000T);
  EmployeeNoFilter:='RL';
  IF NOT TmpSharePointTableLink.ISTEMPORARY THEN
    ERROR('TmpSharePoint link variable must be temporary.');
  TmpSharePointTableLink.DELETEALL;
  IF (EmployeeNoFilter<>'') THEN BEGIN
    WITH TmpSharePointTableLink DO BEGIN
      INIT;
      "Entry No.":=10000;
      "SP List Setup Code":=SharePointListSetupCode;
      Type:=Type::SPRecordCondition;
      "Lookup SP Column Internal Name":='EmployeeNo';
      "Lookup SP Column Title":='EmployeeNo';
      "Lookup SP Data Type":="Lookup SP Data Type"::Text;
      "Source Table ID":=DATABASE::Employee;
      "Value/Field Name":=EmployeeNoFilter;
      INSERT;
    END;
  END;
 
  //Call the synchronization
  NSPInterface.SynchronizeFromSP('EMPLOYEE_LIST','',TRUE,SyncFromSPDateTime,TmpSharePointTableLink);