public static TranslateSharepointValueArgs TranslateSharepointValue( [NotNull] SharepointBaseItem sourceSharepointItem, [NotNull] string sourceFieldName, [NotNull] Item targetIntegrationItem, [NotNull] string targetFieldName) { Assert.ArgumentNotNull(sourceSharepointItem, "sourceSharepointItem"); Assert.ArgumentNotNull(sourceFieldName, "sourceFieldName"); Assert.ArgumentNotNull(targetIntegrationItem, "targetIntegrationItem"); Assert.ArgumentNotNull(targetFieldName, "targetFieldName"); var pipelineArgs = new TranslateSharepointValueArgs(sourceSharepointItem, sourceFieldName, targetIntegrationItem, targetFieldName); return(TranslateSharepointValue(pipelineArgs) ? pipelineArgs : null); }
/// <summary> /// Update fields of integration item in CMS from SharePoint. /// </summary> /// <param name="targetIntegrationItem">The item.</param> /// <param name="sourceSharepointItem">The source.</param> /// <param name="synchContext">The synchronization context.</param> public static void UpdateFields([NotNull] Item targetIntegrationItem, [NotNull] SharepointBaseItem sourceSharepointItem, [NotNull] SynchContext synchContext) { Assert.ArgumentNotNull(targetIntegrationItem, "targetIntegrationItem"); Assert.ArgumentNotNull(sourceSharepointItem, "sourceSharepointItem"); Assert.ArgumentNotNull(synchContext, "synchContext"); var folderItem = sourceSharepointItem as FolderItem; if (folderItem != null) { UpdateIntegrationConfigData(targetIntegrationItem, folderItem, synchContext); } using (new EditContext(targetIntegrationItem)) { if (string.IsNullOrEmpty(targetIntegrationItem.Fields[FieldNames.GUID].Value)) { if (targetIntegrationItem.Template.GetField(SharepointFieldIDs.IsIntegrationItem) != null) { new CheckboxField(targetIntegrationItem.Fields[SharepointFieldIDs.IsIntegrationItem]).Checked = true; } } targetIntegrationItem.Fields[FieldNames.GUID].Value = sourceSharepointItem.GUID; foreach (IntegrationConfigData.FieldMapping mapping in synchContext.IntegrationConfigData.FieldMappings) { if (targetIntegrationItem.Fields[mapping.Target] != null) { TranslateSharepointValueArgs pipelineArgs = TranslateSynchValuePipelinesRunner.TranslateSharepointValue(sourceSharepointItem, mapping.Source, targetIntegrationItem, mapping.Target); if (pipelineArgs != null) { targetIntegrationItem[mapping.Target] = pipelineArgs.TranslatedValue; } } } } }
public static bool TranslateSharepointValue([NotNull] TranslateSharepointValueArgs pipelineArgs) { Assert.ArgumentNotNull(pipelineArgs, "pipelineArgs"); return(PipelineRunner.Run(PipelineNames.TranslateSharepointValue, pipelineArgs)); }