Exemple #1
0
        private void AddContactEmailAttributes(MASchemaType type, IManagementAgentParameters config)
        {
            AdapterSubfield address = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "address",
                IsMultivalued     = false,
                Operation         = AttributeOperation.ImportExport,
                PropertyName      = "Address",
                AttributeNamePart = null
            };

            AdapterGDataCommonAttributeList <EMail> customType = new AdapterGDataCommonAttributeList <EMail>
            {
                Api           = "contact",
                AttributeName = "email",
                Fields        = new List <AdapterSubfield>()
                {
                    address
                },
                FieldName     = "email",
                PropertyName  = "Emails",
                KnownTypes    = config.EmailsAttributeFixedTypes?.ToList(),
                SupportsPatch = false,
                IsEmpty       = (t) => string.IsNullOrWhiteSpace(t.Address),
                KnownRels     = new Dictionary <string, string>()
                {
                    { "http://schemas.google.com/g/2005#work", "work" }, { "http://schemas.google.com/g/2005#home", "home" }, { "http://schemas.google.com/g/2005#other", "other" }
                }
            };

            type.AttributeAdapters.Add(customType);
        }
Exemple #2
0
        private void AddContactPhones(MASchemaType type, IManagementAgentParameters config)
        {
            AdapterSubfield phonesValue = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "value",
                IsMultivalued     = false,
                Operation         = AttributeOperation.ImportExport,
                PropertyName      = "Value",
                AttributeNamePart = null
            };

            AdapterGDataCommonAttributeList <PhoneNumber> phonesType = new AdapterGDataCommonAttributeList <PhoneNumber>
            {
                Api           = "contact",
                AttributeName = "phones",
                Fields        = new List <AdapterSubfield>()
                {
                    phonesValue
                },
                FieldName     = "phones",
                PropertyName  = "Phonenumbers",
                KnownTypes    = config.PhonesAttributeFixedTypes?.ToList(),
                SupportsPatch = false,
                IsEmpty       = (t) => string.IsNullOrWhiteSpace(t.Value),
                KnownRels     = new Dictionary <string, string>()
                {
                    { "http://schemas.google.com/g/2005#work_pager", "work_pager" },
                    { "http://schemas.google.com/g/2005#work_mobile", "work_mobile" },
                    { "http://schemas.google.com/g/2005#work", "work" },
                    { "http://schemas.google.com/g/2005#tty_tdd", "tty_tdd" },
                    { "http://schemas.google.com/g/2005#telex", "telex" },
                    { "http://schemas.google.com/g/2005#radio", "radio" },
                    { "http://schemas.google.com/g/2005#pager", "pager" },
                    { "http://schemas.google.com/g/2005#other_fax", "other_fax" },
                    { "http://schemas.google.com/g/2005#mobile", "mobile" },
                    { "http://schemas.google.com/g/2005#main", "main" },
                    { "http://schemas.google.com/g/2005#isdn", "isdn" },
                    { "http://schemas.google.com/g/2005#home_fax", "home_fax" },
                    { "http://schemas.google.com/g/2005#home", "home" },
                    { "http://schemas.google.com/g/2005#fax", "fax" },
                    { "http://schemas.google.com/g/2005#company_main", "company_main" },
                    { "http://schemas.google.com/g/2005#car", "car" },
                    { "http://schemas.google.com/g/2005#callback", "callback" },
                    { "http://schemas.google.com/g/2005#assistant", "assistant" },
                }
            };

            type.AttributeAdapters.Add(phonesType);
        }
Exemple #3
0
        private void AddContactIms(MASchemaType type, IManagementAgentParameters config)
        {
            AdapterSubfield im = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "address",
                IsMultivalued     = false,
                Operation         = AttributeOperation.ImportExport,
                PropertyName      = "Address",
                AttributeNamePart = "address"
            };

            AdapterSubfield protocol = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "protocol",
                IsMultivalued     = false,
                Operation         = AttributeOperation.ImportExport,
                PropertyName      = "Protocol",
                AttributeNamePart = "protocol"
            };

            AdapterGDataCommonAttributeList <IMAddress> customType = new AdapterGDataCommonAttributeList <IMAddress>
            {
                Api           = "contact",
                AttributeName = "ims",
                Fields        = new List <AdapterSubfield>()
                {
                    im, protocol
                },
                FieldName     = "ims",
                PropertyName  = "IMs",
                KnownTypes    = config.IMsAttributeFixedTypes?.ToList(),
                SupportsPatch = false,
                IsEmpty       = (t) => string.IsNullOrWhiteSpace(t.Address),

                KnownRels = new Dictionary <string, string>()
                {
                    { "http://schemas.google.com/g/2005#work", "work" },
                    { "http://schemas.google.com/g/2005#netmeeting", "netmeeting" },
                    { "http://schemas.google.com/g/2005#home", "home" }
                }
            };

            type.AttributeAdapters.Add(customType);
        }
Exemple #4
0
        private void AddContactOrganizationsAttributes(MASchemaType type, IManagementAgentParameters config)
        {
            AdapterSubfield name = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "orgName",
                IsMultivalued     = false,
                Operation         = AttributeOperation.ImportExport,
                PropertyName      = "Name",
                AttributeNamePart = "name"
            };

            AdapterSubfield title = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "orgTitle",
                IsMultivalued     = false,
                PropertyName      = "Title",
                Operation         = AttributeOperation.ImportExport,
                AttributeNamePart = "title"
            };

            AdapterSubfield department = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "orgDepartment",
                IsMultivalued     = false,
                PropertyName      = "Department",
                Operation         = AttributeOperation.ImportExport,
                AttributeNamePart = "department"
            };

            AdapterSubfield symbol = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "orgSymbol",
                IsMultivalued     = false,
                PropertyName      = "Symbol",
                Operation         = AttributeOperation.ImportExport,
                AttributeNamePart = "symbol"
            };

            AdapterSubfield jobDescription = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "orgJobDescription",
                IsMultivalued     = false,
                PropertyName      = "JobDescription",
                Operation         = AttributeOperation.ImportExport,
                AttributeNamePart = "jobDescription"
            };

            AdapterSubfield location = new AdapterSubfield
            {
                AttributeType     = AttributeType.String,
                FieldName         = "where",
                IsMultivalued     = false,
                PropertyName      = "Location",
                Operation         = AttributeOperation.ImportExport,
                AttributeNamePart = "location"
            };

            AdapterGDataCommonAttributeList <Organization> customType = new AdapterGDataCommonAttributeList <Organization>
            {
                Api           = "contact",
                AttributeName = "organizations",
                Fields        = new List <AdapterSubfield>()
                {
                    name, title, department, symbol, location, jobDescription
                },
                FieldName     = "organizations",
                PropertyName  = "Organizations",
                KnownTypes    = config.OrganizationsAttributeFixedTypes?.ToList(),
                SupportsPatch = false,
                IsEmpty       = (t) =>
                {
                    return(string.IsNullOrWhiteSpace(t.Department) &&
                           string.IsNullOrWhiteSpace(t.JobDescription) &&
                           string.IsNullOrWhiteSpace(t.Name) &&
                           string.IsNullOrWhiteSpace(t.Title) &&
                           string.IsNullOrWhiteSpace(t.Symbol) &&
                           string.IsNullOrWhiteSpace(t.Location));
                },
                KnownRels = new Dictionary <string, string>()
                {
                    { "http://schemas.google.com/g/2005#work", "work" }
                }
            };

            type.AttributeAdapters.Add(customType);
        }