private void LoadProperties(SPList list)
        {
            SPView view = list.DefaultView;

            foreach (string fieldName in view.ViewFields)
            {
                if (fieldName != "Title")
                {
                    SPField            field    = list.Fields.GetFieldByInternalName(fieldName);
                    AssignmentProperty property = CreateProperty(field);
                    if (property != null)
                    {
                        Properties.Add(property);
                        object value = customPropertiesItem[fieldName];
                        if (value != null)
                        {
                            string propertyValue = value.ToString();
                            switch (property.Type)
                            {
                            case AssignmentPropertyType.Url:
                                property.Value = UrlValue(propertyValue);
                                break;

                            case AssignmentPropertyType.Text:
                                TextAssignmentProperty textProperty = (TextAssignmentProperty)property;
                                if (textProperty.IsMultiLine)
                                {
                                    property.Value = CleanMultilineValue(propertyValue);
                                }
                                else
                                {
                                    property.Value = propertyValue;
                                }
                                break;

                            default:
                                property.Value = propertyValue;
                                break;
                            }
                        }
                    }
                }
            }
        }
        private AssignmentProperty CreateProperty(SPField field)
        {
            switch (field.Type)
            {
            case SPFieldType.Text:
                return(new TextAssignmentProperty(field.Title, field.InternalName, field.Required));

            case SPFieldType.Note:
                TextAssignmentProperty property = new TextAssignmentProperty(field.Title, field.InternalName, field.Required);
                property.IsMultiLine = true;
                return(property);

            case SPFieldType.URL:
                return(new UrlAssignmentProperty(field.Title, field.InternalName, field.Required));

            case SPFieldType.Choice:
                SPFieldChoice choice = (SPFieldChoice)field;
                return(new ChoiceAssignmentProperty(field.Title, field.InternalName, field.Required, choice.Choices, choice.DefaultValue));

            default:
                return(null);
            }
        }