Connectors

Document Check in

To automatically check-in SharePoint Documents after they have been created you will need to use Project Automation Item Events with the SharePoint API to check-in the document.

Add code to the Project Automation class to get a reference to the SharePoint Lists Web Service

private Simego.DataSync.ListWS.Lists _listService;
	
private Simego.DataSync.ListWS.Lists ListService
{
    get
    {
        if(_listService == null)
        {
            _listService = DataSourceB.GetSharePointListService();
        }
        return _listService;
    }
}

Add code to the AfterAddItem method to check in the document after it is uploaded to SharePoint.

This code creates the URL from the SharePoint connection configuration and uses the FullFileName column from the source schema, this maybe different depending on the connector you are using.

Note: Checking in a Document will update the Modified column to time of the check in so this will always be different to your source value.

public override void AfterAddItem(object sender, DataCompareItemInvariant item, object identity)
{	
    var filename = item.SourceRow.Get("FullFileName").BeforeColumnValue;
    string fileCheckin = string.Format("{0}{1}{2}/{3}", DataSourceB.SharePointUrl, DataSourceB.RootFolder, DataSourceB.ListName, filename);

    // fileUrl - A string that contains the full path to the document to check in.
    // comment - A string containing optional check-in comments.
    // CheckinType - A string representation of the values 0, 1 or 2, where 0 = MinorCheckIn, 1 = MajorCheckIn, and 2 = OverwriteCheckIn.
			
    ListService.CheckInFile(fileCheckin, "Uploaded by DataSync", "2");
}

If you also need to support checkout before Update and then check in after the upload you can implement something similar with the Before and After Item Events.