private JsonElement GetJsonSource(JsonElement sourceJson, ListItemPropertyCreationInfo property) { if(IsDateFormText(property)) { return sourceJson.GetProperty("FieldValuesAsText"); } if(property.SharePointFieldType == SharePointFieldType.LookupValue) { return sourceJson.GetProperty(property.SharePointFieldName); } return sourceJson; }
private static string GetJsonFieldName(ListItemPropertyCreationInfo property) { string fieldName; switch(property.SharePointFieldType) { case SharePointFieldType.LookupId: fieldName = $"{property.SharePointFieldName}Id"; break; case SharePointFieldType.LookupValue: fieldName = (string)property.AdditionalData; break; default: fieldName = property.SharePointFieldName; break; } return fieldName; }
private bool IsDateFormText(ListItemPropertyCreationInfo propertyCreationInfo) { var isDateFromText = datesFromText && Type.GetTypeCode(propertyCreationInfo.PropertyToSet.PropertyType) == TypeCode.DateTime; return isDateFromText; }